Instruments are obtained through builders provided by this interface. Each builder has a default measurement type (long or double) that may be changed.
Choosing an instrument can be hard, but here's a rule of thumb for selecting the right instrument:
meter.counterBuilder("my-counter").build()
meter.upDownCounterBuilder("my-up-down-counter").build()
meter.histogramBuilder("my-histogram").build()
meter.gaugeBuilder("my-gauge").buildWithCallback(observableMeasurement -> observableMeasurement.record(..))
meter.counterBuilder("my-async-counter").buildWithCallback(observableMeasurement -> observableMeasurement.record(..))
meter.upDownCounterBuilder("my-async-counter").buildWithCallback(observableMeasurement -> observableMeasurement.record(..))
| Modifier and Type | Method and Description |
|---|---|
| public default BatchCallback | batchCallback(Runnable
a callback used to observe values on-demand. callback, ObservableMeasurement Instruments for which the callback may observe values. observableMeasurement, ObservableMeasurement... Instruments for which the callback may observe values. additionalMeasurements)Constructs a batch callback. |
| public LongCounterBuilder | Returns: a builder for configuring a Counter instrument. Defaults to recording long values, but may be changed.the name of the Counter. Instrument names must consist of 255 or fewer characters
including alphanumeric, _, ., -, /, and start with a letter. name)Constructs a Counter instrument. |
| public DoubleGaugeBuilder | Returns: a builder used for configuring a Gauge instrument. Defaults to recording double values, but may be changed.the name of the Gauge. Instrument names must consist of 255 or fewer characters
including alphanumeric, _, ., -, /, and start with a letter. name)Constructs an Asynchronous Gauge instrument. |
| public DoubleHistogramBuilder | Returns: a builder for configuring a Histogram synchronous instrument. Defaults to recording double values, but may be changed.the name of the Histogram. Instrument names must consist of 255 or fewer characters
including alphanumeric, _, ., -, /, and start with a letter. name)Constructs a Histogram instrument. |
| public LongUpDownCounterBuilder | Returns: a builder for configuring an UpDownCounter instrument. Defaults to recording long values, but may be changed.the name of the UpDownCounter. Instrument names must consist of 255 or fewer
characters including alphanumeric, _, ., -, /, and start with a letter. name)Constructs an UpDownCounter instrument. |
| batchCallback | back to summary |
|---|---|
| public default BatchCallback batchCallback(Runnable callback, ObservableMeasurement observableMeasurement, ObservableMeasurement... additionalMeasurements) 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:
| |
| counterBuilder | back to summary |
|---|---|
| public LongCounterBuilder counterBuilder(String name) Constructs a Counter instrument. This is used to build both synchronous instruments and asynchronous instruments (i.e. callbacks).
| |
| gaugeBuilder | back to summary |
|---|---|
| public DoubleGaugeBuilder gaugeBuilder(String name) Constructs an Asynchronous Gauge instrument.
| |
| histogramBuilder | back to summary |
|---|---|
| public DoubleHistogramBuilder histogramBuilder(String name) Constructs a Histogram instrument.
| |
| upDownCounterBuilder | back to summary |
|---|---|
| public LongUpDownCounterBuilder upDownCounterBuilder(String name) Constructs an UpDownCounter instrument. This is used to build both synchronous instruments and asynchronous instruments (i.e. callbacks).
| |