Class HTTPServer.Builder
java.lang.Object
io.prometheus.metrics.exporter.httpserver.HTTPServer.Builder
- Enclosing class:
- HTTPServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Authenticatorprivate final PrometheusPropertiesprivate HttpHandlerprivate ExecutorServiceprivate Stringprivate HttpsConfiguratorprivate InetAddressprivate Stringprivate Integerprivate Booleanprivate PrometheusRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertNull(Object o, String msg) authenticatedSubjectAttributeName(String authenticatedSubjectAttributeName) Optional: the attribute name of a Subject from a custom authenticator.authenticator(Authenticator authenticator) Optional:Authenticatorfor authentication.Build and start the HTTPServer.defaultHandler(HttpHandler defaultHandler) Optional: Override default handler, i.e.executorService(ExecutorService executorService) Optional: ExecutorService used by thehttpServer.private intfindPort()Use this hostname to resolve the IP address to bind to.httpsConfigurator(HttpsConfigurator configurator) Optional:HttpsConfiguratorfor TLS/SSLinetAddress(InetAddress address) Bind to this IP address.private ExecutorServiceprivate InetSocketAddressmetricsHandlerPath(String metricsHandlerPath) Optional: Override default path for the metrics endpoint.port(int port) Port to bind to.registerHealthHandler(boolean registerHealthHandler) Optional: Override if the health handler should be registered.registry(PrometheusRegistry registry) Optional: Default isPrometheusRegistry.defaultRegistry.
-
Field Details
-
config
-
port
-
hostname
-
inetAddress
-
executorService
-
registry
-
authenticator
-
authenticatedSubjectAttributeName
-
httpsConfigurator
-
defaultHandler
-
metricsHandlerPath
-
registerHealthHandler
-
-
Constructor Details
-
Builder
-
-
Method Details
-
port
Port to bind to. Default is 0, indicating that a random port will be selected. You can learn the randomly selected port by callingHTTPServer.getPort(). -
hostname
Use this hostname to resolve the IP address to bind to. Must not be called together withinetAddress(InetAddress). Default is empty, indicating that the HTTPServer binds to the wildcard address. -
inetAddress
Bind to this IP address. Must not be called together withhostname(String). Default is empty, indicating that the HTTPServer binds to the wildcard address. -
executorService
Optional: ExecutorService used by thehttpServer. -
registry
Optional: Default isPrometheusRegistry.defaultRegistry. -
authenticator
Optional:Authenticatorfor authentication. -
authenticatedSubjectAttributeName
public HTTPServer.Builder authenticatedSubjectAttributeName(String authenticatedSubjectAttributeName) Optional: the attribute name of a Subject from a custom authenticator. -
httpsConfigurator
Optional:HttpsConfiguratorfor TLS/SSL -
defaultHandler
Optional: Override default handler, i.e. the handler that will be registered for the / endpoint. -
metricsHandlerPath
Optional: Override default path for the metrics endpoint. Default is/metrics. -
registerHealthHandler
Optional: Override if the health handler should be registered. Default istrue. -
buildAndStart
Build and start the HTTPServer.- Throws:
IOException
-
makeInetSocketAddress
-
makeExecutorService
-
findPort
private int findPort() -
assertNull
-