Class HTTPServer
java.lang.Object
io.prometheus.metrics.exporter.httpserver.HTTPServer
- All Implemented Interfaces:
Closeable,AutoCloseable
Expose Prometheus metrics using a plain Java HttpServer.
Example Usage:
HTTPServer server = HTTPServer.newBuilder()
.withPort(9090)
.buildAndStart();
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ExecutorServiceprotected final com.sun.net.httpserver.HttpServer -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stop the HTTPServer.intgetPort()Gets the port number.static HTTPServer.Builderstatic HTTPServer.BuildernewBuilder(io.prometheus.metrics.config.PrometheusProperties config) voidstop()Stop the HTTP server.
-
Field Details
-
server
-
executorService
-
-
Method Details
-
stop
Stop the HTTP server. Same asclose(). -
close
Stop the HTTPServer. Same asstop().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getPort
Gets the port number. This is useful if you did not specify a port and the server picked a free port automatically. -
newBuilder
-
newBuilder
public static HTTPServer.Builder newBuilder(io.prometheus.metrics.config.PrometheusProperties config)
-