Package io.opentelemetry.api.metrics
Interface LongGaugeBuilder
-
public interface LongGaugeBuilderA builder for Gauge metric types. These can only be asynchronously collected.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbuildWithCallback(Consumer<ObservableLongMeasurement> callback)Builds this asynchronous insturment with the given callback.DoubleGaugeBuilderofDoubles()Sets the gauge for recordingdoublevalues.LongGaugeBuildersetDescription(String description)Sets the description for this instrument.LongGaugeBuildersetUnit(String unit)Sets the unit of measure for this instrument.
-
-
-
Method Detail
-
setDescription
LongGaugeBuilder setDescription(String description)
Sets the description for this instrument.Description strings should follow the instrument description rules: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-description
-
setUnit
LongGaugeBuilder setUnit(String unit)
Sets the unit of measure for this instrument.Unit strings should follow the instrument unit rules: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-unit
-
ofDoubles
DoubleGaugeBuilder ofDoubles()
Sets the gauge for recordingdoublevalues.
-
buildWithCallback
void buildWithCallback(Consumer<ObservableLongMeasurement> callback)
Builds this asynchronous insturment with the given callback.The callback will only be called when the
Meteris being observed.- Parameters:
callback- A state-capturing callback used to observe values on-demand.
-
-