Class OpenTelemetryMeterRegistryBuilder

java.lang.Object
io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistryBuilder

public final class OpenTelemetryMeterRegistryBuilder extends Object
  • Method Details

    • setClock

      @CanIgnoreReturnValue public OpenTelemetryMeterRegistryBuilder setClock(io.micrometer.core.instrument.Clock clock)
      Sets a custom Clock. 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's PrometheusMeterRegistry. The instruments will be renamed to match Micrometer instrument naming, and the base time unit will be set to seconds.

      Set this to true if 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's DistributionSummary and Timer service 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 true to enable gauge-based Micrometer histograms.

    • build

      public io.micrometer.core.instrument.MeterRegistry build()
      Returns a new OpenTelemetryMeterRegistry with the settings of this OpenTelemetryMeterRegistryBuilder.