Class PrometheusHttpServerBuilder
java.lang.Object
io.opentelemetry.exporter.prometheus.PrometheusHttpServerBuilder
A builder for
PrometheusHttpServer
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newPrometheusHttpServer
with the configuration of this builder which can be registered with aSdkMeterProvider
.setAllowedResourceAttributesFilter
(Predicate<String> resourceAttributesFilter) Set if the resource attributes should be added as labels on each exported metric.setExecutor
(ExecutorService executor) Sets theExecutorService
to be used forPrometheusHttpServer
.Sets the host to bind to.setOtelScopeEnabled
(boolean otelScopeEnabled) Set if theotel_scope_*
attributes are generated.setPort
(int port) Sets the port to bind to.setPrometheusRegistry
(io.prometheus.metrics.model.registry.PrometheusRegistry prometheusRegistry) Sets thePrometheusRegistry
to be used forPrometheusHttpServer
.
-
Method Details
-
setHost
Sets the host to bind to. If unset, defaults to "0.0.0.0". -
setPort
Sets the port to bind to. If unset, defaults to 9464. -
setExecutor
Sets theExecutorService
to be used forPrometheusHttpServer
. -
setPrometheusRegistry
public PrometheusHttpServerBuilder setPrometheusRegistry(io.prometheus.metrics.model.registry.PrometheusRegistry prometheusRegistry) Sets thePrometheusRegistry
to be used forPrometheusHttpServer
. -
setOtelScopeEnabled
Set if theotel_scope_*
attributes are generated. Default istrue
. -
setAllowedResourceAttributesFilter
public PrometheusHttpServerBuilder setAllowedResourceAttributesFilter(Predicate<String> resourceAttributesFilter) Set if the resource attributes should be added as labels on each exported metric.If set, resource attributes will be added as labels on each exported metric if their key tests positive (true) when passed through
resourceAttributesFilter
.- Parameters:
resourceAttributesFilter
- a predicate that returns true if the resource attribute should be added as a label on each exported metric. The predicates input is the resource attribute key.
-
build
Returns a newPrometheusHttpServer
with the configuration of this builder which can be registered with aSdkMeterProvider
.
-