Class HTTPServer.Builder
java.lang.Object
io.prometheus.metrics.exporter.httpserver.HTTPServer.Builder
- Enclosing class:
- HTTPServer
-
Method Summary
Modifier and TypeMethodDescriptionBuild and start the HTTPServer.withAuthenticator(com.sun.net.httpserver.Authenticator authenticator) Optional:Authenticatorfor authentication.withDefaultHandler(com.sun.net.httpserver.HttpHandler defaultHandler) Optional: Override default handler, i.e.withExecutorService(ExecutorService executorService) Optional: ExecutorService used by thehttpServer.withHostname(String hostname) Use this hostname to resolve the IP address to bind to.withHttpsConfigurator(com.sun.net.httpserver.HttpsConfigurator configurator) Optional:HttpsConfiguratorfor TLS/SSLwithInetAddress(InetAddress address) Bind to this IP address.withPort(int port) Port to bind to.withRegistry(io.prometheus.metrics.model.registry.PrometheusRegistry registry) Optional: Default isPrometheusRegistry.defaultRegistry.
-
Method Details
-
withPort
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(). -
withHostname
Use this hostname to resolve the IP address to bind to. Must not be called together withwithInetAddress(InetAddress). Default is empty, indicating that the HTTPServer binds to the wildcard address. -
withInetAddress
Bind to this IP address. Must not be called together withwithHostname(String). Default is empty, indicating that the HTTPServer binds to the wildcard address. -
withExecutorService
Optional: ExecutorService used by thehttpServer. -
withRegistry
public HTTPServer.Builder withRegistry(io.prometheus.metrics.model.registry.PrometheusRegistry registry) Optional: Default isPrometheusRegistry.defaultRegistry. -
withAuthenticator
Optional:Authenticatorfor authentication. -
withHttpsConfigurator
public HTTPServer.Builder withHttpsConfigurator(com.sun.net.httpserver.HttpsConfigurator configurator) Optional:HttpsConfiguratorfor TLS/SSL -
withDefaultHandler
Optional: Override default handler, i.e. the handler that will be registered for the / endpoint. -
buildAndStart
Build and start the HTTPServer.- Throws:
IOException
-