Class OpenTelemetryMeterRegistryBuilder
java.lang.Object
io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistryBuilder
A builder of
OpenTelemetryMeterRegistry.-
Method Summary
Modifier and TypeMethodDescriptionio.micrometer.core.instrument.MeterRegistrybuild()Returns a newOpenTelemetryMeterRegistrywith the settings of thisOpenTelemetryMeterRegistryBuilder.setBaseTimeUnit(TimeUnit baseTimeUnit) Sets the base time unit.setClock(io.micrometer.core.instrument.Clock clock) Sets a customClock.setMicrometerHistogramGaugesEnabled(boolean histogramGaugesEnabled) Enables the generation of gauge-based Micrometer histograms.setPrometheusMode(boolean prometheusMode) Enables the "Prometheus mode" - this will simulate the behavior of Micrometer'sPrometheusMeterRegistry.
-
Method Details
-
setClock
@CanIgnoreReturnValue public OpenTelemetryMeterRegistryBuilder setClock(io.micrometer.core.instrument.Clock clock) Sets a customClock. Useful for testing. -
setBaseTimeUnit
@CanIgnoreReturnValue public OpenTelemetryMeterRegistryBuilder setBaseTimeUnit(TimeUnit baseTimeUnit) Sets the base time unit. -
setPrometheusMode
@CanIgnoreReturnValue public OpenTelemetryMeterRegistryBuilder setPrometheusMode(boolean prometheusMode) Enables the "Prometheus mode" - this will simulate the behavior of Micrometer'sPrometheusMeterRegistry. The instruments will be renamed to match Micrometer instrument naming, and the base time unit will be set to seconds.Set this to
trueif you are using the Prometheus metrics exporter. -
setMicrometerHistogramGaugesEnabled
@CanIgnoreReturnValue public OpenTelemetryMeterRegistryBuilder setMicrometerHistogramGaugesEnabled(boolean histogramGaugesEnabled) Enables the generation of gauge-based Micrometer histograms. While the Micrometer bridge is able to map Micrometer'sDistributionSummaryandTimerservice level objectives to OpenTelemetry histogram buckets, it might not cover all cases that are normally supported by Micrometer (e.g. the bridge is not able to translate percentiles). With this setting enabled, the Micrometer bridge will additionally emit Micrometer service level objectives and percentiles as separate gauges.Note that this setting does not concern the
LongTaskTimer, as it is not bridged to an OpenTelemetry histogram.This is disabled by default, set this to
trueto enable gauge-based Micrometer histograms. -
build
public io.micrometer.core.instrument.MeterRegistry build()Returns a newOpenTelemetryMeterRegistrywith the settings of thisOpenTelemetryMeterRegistryBuilder.
-