Class DefaultMeter

  • All Implemented Interfaces:
    Meter

    @ThreadSafe
    class DefaultMeter
    extends java.lang.Object
    implements Meter
    No-op implementation of Meter.

    This implementation should induce as close to zero overhead as possible.

    • Constructor Detail

      • DefaultMeter

        private DefaultMeter()
    • Method Detail

      • getInstance

        static Meter getInstance()
      • counterBuilder

        public LongCounterBuilder counterBuilder​(java.lang.String name)
        Description copied from interface: Meter
        Constructs a Counter instrument.

        This is used to build both synchronous instruments and asynchronous instruments (i.e. callbacks).

        Specified by:
        counterBuilder in interface Meter
        Parameters:
        name - the name of the Counter. Instrument names must consist of 255 or fewer characters including alphanumeric, _, ., -, /, and start with a letter.
        Returns:
        a builder for configuring a Counter instrument. Defaults to recording long values, but may be changed.
        See Also:
        Instrument Naming Rule
      • upDownCounterBuilder

        public LongUpDownCounterBuilder upDownCounterBuilder​(java.lang.String name)
        Description copied from interface: Meter
        Constructs an UpDownCounter instrument.

        This is used to build both synchronous instruments and asynchronous instruments (i.e. callbacks).

        Specified by:
        upDownCounterBuilder in interface Meter
        Parameters:
        name - the name of the UpDownCounter. Instrument names must consist of 255 or fewer characters including alphanumeric, _, ., -, /, and start with a letter.
        Returns:
        a builder for configuring an UpDownCounter instrument. Defaults to recording long values, but may be changed.
        See Also:
        Instrument Naming Rule
      • histogramBuilder

        public DoubleHistogramBuilder histogramBuilder​(java.lang.String name)
        Description copied from interface: Meter
        Constructs a Histogram instrument.
        Specified by:
        histogramBuilder in interface Meter
        Parameters:
        name - the name of the Histogram. Instrument names must consist of 255 or fewer characters including alphanumeric, _, ., -, /, and start with a letter.
        Returns:
        a builder for configuring a Histogram synchronous instrument. Defaults to recording double values, but may be changed.
        See Also:
        Instrument Naming Rule
      • gaugeBuilder

        public DoubleGaugeBuilder gaugeBuilder​(java.lang.String name)
        Description copied from interface: Meter
        Constructs an Asynchronous Gauge instrument.
        Specified by:
        gaugeBuilder in interface Meter
        Parameters:
        name - the name of the Gauge. Instrument names must consist of 255 or fewer characters including alphanumeric, _, ., -, /, and start with a letter.
        Returns:
        a builder used for configuring a Gauge instrument. Defaults to recording double values, but may be changed.
        See Also:
        Instrument Naming Rule
      • batchCallback

        public BatchCallback batchCallback​(java.lang.Runnable callback,
                                           ObservableMeasurement observableMeasurement,
                                           ObservableMeasurement... additionalMeasurements)
        Description copied from interface: Meter
        Constructs a batch callback.

        Batch callbacks allow a single callback to observe measurements for multiple asynchronous instruments.

        The callback will be called when the instruments are 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.
        • Only observe values to registered instruments (i.e. observableMeasurement and additionalMeasurements
        Specified by:
        batchCallback in interface Meter
        Parameters:
        callback - a callback used to observe values on-demand.
        observableMeasurement - Instruments for which the callback may observe values.
        additionalMeasurements - Instruments for which the callback may observe values.