Package io.opentelemetry.api.metrics
Interface DoubleGaugeBuilder
public interface DoubleGaugeBuilder
A builder for Gauge metric types. These can only be asynchronously collected.
- Since:
- 1.10.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault ObservableDoubleMeasurement
Build an observer for this instrument to observe values from aBatchCallback
.buildWithCallback
(Consumer<ObservableDoubleMeasurement> callback) Builds an Asynchronous Gauge instrument with the given callback.ofLongs()
Sets the Gauge for recordinglong
values.setDescription
(String description) Sets the description for this instrument.Sets the unit of measure for this instrument.
-
Method Details
-
setDescription
Sets the description for this instrument.- Parameters:
description
- The description.- See Also:
-
setUnit
Sets the unit of measure for this instrument.- Parameters:
unit
- The unit. Instrument units must be 63 or fewer ASCII characters.- See Also:
-
ofLongs
LongGaugeBuilder ofLongs()Sets the Gauge for recordinglong
values. -
buildWithCallback
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.
- Parameters:
callback
- A callback which observes measurements when invoked.
-
buildObserver
Build an observer for this instrument to observe values from aBatchCallback
.This observer MUST be registered when creating a
batchCallback
, which records to it. Values observed outside registered callbacks are ignored.- Returns:
- an observable measurement that batch callbacks use to observe values.
- Since:
- 1.15.0
-