Class ExtendedDefaultMeter.NoopLongGaugeBuilder

    • Constructor Detail

      • NoopLongGaugeBuilder

        private NoopLongGaugeBuilder()
    • Method Detail

      • buildWithCallback

        public ObservableLongGauge buildWithCallback​(java.util.function.Consumer<ObservableLongMeasurement> callback)
        Description copied from interface: LongGaugeBuilder
        Builds an Asynchronous Gauge instrument with the given callback.

        The callback will be called when the instrument is being observed.

        Callbacks are expected to abide by the following restrictions:

        • Run in a finite amount of time.
        • Safe to call repeatedly, across multiple threads.
        Specified by:
        buildWithCallback in interface LongGaugeBuilder
        Parameters:
        callback - A callback which observes measurements when invoked.
      • build

        public LongGauge build()
        Description copied from interface: LongGaugeBuilder
        Builds and returns a LongGauge instrument with the configuration.

        NOTE: This produces a synchronous gauge which records gauge values as they occur. Most users will want to instead register an LongGaugeBuilder.buildWithCallback(Consumer) to asynchronously observe the value of the gauge when metrics are collected.

        If using the OpenTelemetry SDK, by default gauges use last value aggregation, such that only the value of the last recorded measurement is exported.

        Specified by:
        build in interface LongGaugeBuilder
        Returns:
        The LongGauge instrument.