public static class MqttHTTPServer.Builder extends Object
MqttHTTPServer for compatibility, but new configuration
parameters like sampleNameFilter must be configured using the Builder.| 构造器和说明 |
|---|
Builder() |
| 限定符和类型 | 方法和说明 |
|---|---|
MqttHTTPServer |
build()
Build the HTTPServer
|
MqttHTTPServer.Builder |
withAuthenticator(com.sun.net.httpserver.Authenticator authenticator)
Optional:
Authenticator to use to support authentication. |
MqttHTTPServer.Builder |
withDaemonThreads(boolean daemon)
By default, the
MqttHTTPServer uses non-daemon threads. |
MqttHTTPServer.Builder |
withHostname(String hostname)
Use this hostname to resolve the IP address to bind to.
|
MqttHTTPServer.Builder |
withHttpsConfigurator(com.sun.net.httpserver.HttpsConfigurator configurator)
Optional:
HttpsConfigurator to use to support TLS/SSL |
MqttHTTPServer.Builder |
withHttpServer(com.sun.net.httpserver.HttpServer httpServer)
Use this httpServer.
|
MqttHTTPServer.Builder |
withInetAddress(InetAddress address)
Bind to this IP address.
|
MqttHTTPServer.Builder |
withInetSocketAddress(InetSocketAddress address)
Listen on this address.
|
MqttHTTPServer.Builder |
withPort(int port)
Port to bind to.
|
MqttHTTPServer.Builder |
withRegistry(io.prometheus.client.CollectorRegistry registry)
Optional: Default is
CollectorRegistry.defaultRegistry. |
MqttHTTPServer.Builder |
withSampleNameFilter(io.prometheus.client.Predicate<String> sampleNameFilter)
Optional: Only export time series where
sampleNameFilter.test(name) returns true. |
MqttHTTPServer.Builder |
withSampleNameFilterSupplier(io.prometheus.client.Supplier<io.prometheus.client.Predicate<String>> sampleNameFilterSupplier)
Optional: Only export time series where
sampleNameFilter.test(name) returns true. |
public MqttHTTPServer.Builder withPort(int port)
withInetSocketAddress(InetSocketAddress)
or withHttpServer(HttpServer). Default is 0, indicating that a random port will be selected.public MqttHTTPServer.Builder withHostname(String hostname)
withInetAddress(InetAddress) or withInetSocketAddress(InetSocketAddress)
or withHttpServer(HttpServer).
Default is empty, indicating that the HTTPServer binds to the wildcard address.public MqttHTTPServer.Builder withInetAddress(InetAddress address)
withHostname(String) or
withInetSocketAddress(InetSocketAddress) or withHttpServer(HttpServer).
Default is empty, indicating that the HTTPServer binds to the wildcard address.public MqttHTTPServer.Builder withInetSocketAddress(InetSocketAddress address)
withPort(int),
withHostname(String), withInetAddress(InetAddress), or withHttpServer(HttpServer).public MqttHTTPServer.Builder withHttpServer(com.sun.net.httpserver.HttpServer httpServer)
httpServer is expected to already be bound to an address.
Must not be called together with withPort(int), or withHostname(String),
or withInetAddress(InetAddress), or withInetSocketAddress(InetSocketAddress).public MqttHTTPServer.Builder withDaemonThreads(boolean daemon)
MqttHTTPServer uses non-daemon threads. Set this to true to
run the MqttHTTPServer with daemon threads.public MqttHTTPServer.Builder withSampleNameFilter(io.prometheus.client.Predicate<String> sampleNameFilter)
sampleNameFilter.test(name) returns true.
Use this if the sampleNameFilter remains the same throughout the lifetime of the HTTPServer.
If the sampleNameFilter changes during runtime, use withSampleNameFilterSupplier(Supplier).
public MqttHTTPServer.Builder withSampleNameFilterSupplier(io.prometheus.client.Supplier<io.prometheus.client.Predicate<String>> sampleNameFilterSupplier)
sampleNameFilter.test(name) returns true.
Use this if the sampleNameFilter may change during runtime, like for example if you have a
hot reload mechanism for your filter config.
If the sampleNameFilter remains the same throughout the lifetime of the HTTPServer,
use withSampleNameFilter(Predicate) instead.
public MqttHTTPServer.Builder withRegistry(io.prometheus.client.CollectorRegistry registry)
CollectorRegistry.defaultRegistry.public MqttHTTPServer.Builder withAuthenticator(com.sun.net.httpserver.Authenticator authenticator)
Authenticator to use to support authentication.public MqttHTTPServer.Builder withHttpsConfigurator(com.sun.net.httpserver.HttpsConfigurator configurator)
HttpsConfigurator to use to support TLS/SSLpublic MqttHTTPServer build() throws IOException
IOExceptionCopyright © 2023 The Apache Software Foundation. All rights reserved.