Package io.opentelemetry.api.metrics
Class DefaultMeter
- java.lang.Object
-
- io.opentelemetry.api.metrics.DefaultMeter
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description private static Meter
INSTANCE
private static BatchCallback
NOOP_BATCH_CALLBACK
private static DoubleGaugeBuilder
NOOP_DOUBLE_GAUGE_BUILDER
private static DoubleHistogramBuilder
NOOP_DOUBLE_HISTOGRAM_BUILDER
private static LongCounterBuilder
NOOP_LONG_COUNTER_BUILDER
private static LongUpDownCounterBuilder
NOOP_LONG_UP_DOWN_COUNTER_BUILDER
private static ObservableDoubleMeasurement
NOOP_OBSERVABLE_DOUBLE_MEASUREMENT
private static ObservableLongMeasurement
NOOP_OBSERVABLE_LONG_MEASUREMENT
-
Constructor Summary
Constructors Modifier Constructor Description private
DefaultMeter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchCallback
batchCallback(java.lang.Runnable callback, ObservableMeasurement observableMeasurement, ObservableMeasurement... additionalMeasurements)
Constructs a batch callback.LongCounterBuilder
counterBuilder(java.lang.String name)
Constructs a Counter instrument.DoubleGaugeBuilder
gaugeBuilder(java.lang.String name)
Constructs an Asynchronous Gauge instrument.(package private) static Meter
getInstance()
DoubleHistogramBuilder
histogramBuilder(java.lang.String name)
Constructs a Histogram instrument.LongUpDownCounterBuilder
upDownCounterBuilder(java.lang.String name)
Constructs an UpDownCounter instrument.
-
-
-
Field Detail
-
INSTANCE
private static final Meter INSTANCE
-
NOOP_LONG_COUNTER_BUILDER
private static final LongCounterBuilder NOOP_LONG_COUNTER_BUILDER
-
NOOP_LONG_UP_DOWN_COUNTER_BUILDER
private static final LongUpDownCounterBuilder NOOP_LONG_UP_DOWN_COUNTER_BUILDER
-
NOOP_DOUBLE_HISTOGRAM_BUILDER
private static final DoubleHistogramBuilder NOOP_DOUBLE_HISTOGRAM_BUILDER
-
NOOP_DOUBLE_GAUGE_BUILDER
private static final DoubleGaugeBuilder NOOP_DOUBLE_GAUGE_BUILDER
-
NOOP_BATCH_CALLBACK
private static final BatchCallback NOOP_BATCH_CALLBACK
-
NOOP_OBSERVABLE_DOUBLE_MEASUREMENT
private static final ObservableDoubleMeasurement NOOP_OBSERVABLE_DOUBLE_MEASUREMENT
-
NOOP_OBSERVABLE_LONG_MEASUREMENT
private static final ObservableLongMeasurement NOOP_OBSERVABLE_LONG_MEASUREMENT
-
-
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 interfaceMeter
- 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 interfaceMeter
- 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 interfaceMeter
- 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 interfaceMeter
- 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
andadditionalMeasurements
- Specified by:
batchCallback
in interfaceMeter
- 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.
-
-