java.lang.Object
io.prometheus.metrics.exporter.httpserver.HTTPServer.Builder
Enclosing class:
HTTPServer

public static class HTTPServer.Builder extends Object
  • Method Details

    • port

      public HTTPServer.Builder port(int port)
      Port to bind to. Default is 0, indicating that a random port will be selected. You can learn the randomly selected port by calling HTTPServer.getPort().
    • hostname

      public HTTPServer.Builder hostname(String hostname)
      Use this hostname to resolve the IP address to bind to. Must not be called together with inetAddress(InetAddress). Default is empty, indicating that the HTTPServer binds to the wildcard address.
    • inetAddress

      public HTTPServer.Builder inetAddress(InetAddress address)
      Bind to this IP address. Must not be called together with hostname(String). Default is empty, indicating that the HTTPServer binds to the wildcard address.
    • executorService

      public HTTPServer.Builder executorService(ExecutorService executorService)
      Optional: ExecutorService used by the httpServer.
    • registry

      public HTTPServer.Builder registry(io.prometheus.metrics.model.registry.PrometheusRegistry registry)
      Optional: Default is PrometheusRegistry.defaultRegistry.
    • authenticator

      public HTTPServer.Builder authenticator(com.sun.net.httpserver.Authenticator authenticator)
      Optional: Authenticator for authentication.
    • authenticatedSubjectAttributeName

      public HTTPServer.Builder authenticatedSubjectAttributeName(String authenticatedSubjectAttributeName)
      Optional: the attribute name of a Subject from a custom authenticator.
    • httpsConfigurator

      public HTTPServer.Builder httpsConfigurator(com.sun.net.httpserver.HttpsConfigurator configurator)
      Optional: HttpsConfigurator for TLS/SSL
    • defaultHandler

      public HTTPServer.Builder defaultHandler(com.sun.net.httpserver.HttpHandler defaultHandler)
      Optional: Override default handler, i.e. the handler that will be registered for the / endpoint.
    • buildAndStart

      public HTTPServer buildAndStart() throws IOException
      Build and start the HTTPServer.
      Throws:
      IOException