Class HTTPServer
java.lang.Object
io.prometheus.metrics.exporter.httpserver.HTTPServer
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHTTPServer(PrometheusProperties config, ExecutorService executorService, HttpServer httpServer, PrometheusRegistry registry, Authenticator authenticator, String authenticatedSubjectAttributeName, HttpHandler defaultHandler, String metricsHandlerPath, Boolean registerHealthHandler) -
Method Summary
Modifier and TypeMethodDescriptionstatic HTTPServer.Builderbuilder()static HTTPServer.Builderbuilder(PrometheusProperties config) voidclose()Stop the HTTPServer.private voiddrainInputAndClose(HttpExchange httpExchange) private StringgetMetricsPath(String metricsHandlerPath) intgetPort()Gets the port number.private voidregisterHandler(String path, HttpHandler handler, Authenticator authenticator, String subjectAttributeName) voidstop()Stop the HTTP server.private HttpHandlerwrapWithDoAs(HttpHandler handler, String subjectAttributeName)
-
Field Details
-
server
-
executorService
-
-
Constructor Details
-
HTTPServer
private HTTPServer(PrometheusProperties config, ExecutorService executorService, HttpServer httpServer, PrometheusRegistry registry, Authenticator authenticator, String authenticatedSubjectAttributeName, HttpHandler defaultHandler, String metricsHandlerPath, Boolean registerHealthHandler)
-
-
Method Details
-
getMetricsPath
-
registerHandler
private void registerHandler(String path, HttpHandler handler, Authenticator authenticator, String subjectAttributeName) -
wrapWithDoAs
-
drainInputAndClose
- Throws:
IOException
-
stop
public void stop()Stop the HTTP server. Same asclose(). -
close
public void close()Stop the HTTPServer. Same asstop().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getPort
public int getPort()Gets the port number. This is useful if you did not specify a port and the server picked a free port automatically. -
builder
-
builder
-