Package io.opentelemetry.api.metrics
Interface LongCounterBuilder
-
- All Known Subinterfaces:
ExtendedLongCounterBuilder
- All Known Implementing Classes:
DefaultMeter.NoopLongCounterBuilder,ExtendedDefaultMeter.NoopLongCounterBuilder,SdkLongCounter.SdkLongCounterBuilder
public interface LongCounterBuilderBuilder class forLongCounter.- Since:
- 1.10.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description LongCounterbuild()Builds and returns a Counter instrument with the configuration.default ObservableLongMeasurementbuildObserver()Build an observer for this instrument to observe values from aBatchCallback.ObservableLongCounterbuildWithCallback(java.util.function.Consumer<ObservableLongMeasurement> callback)Builds an Asynchronous Counter instrument with the given callback.DoubleCounterBuilderofDoubles()Sets the Counter for recordingdoublevalues.LongCounterBuildersetDescription(java.lang.String description)Sets the description for this instrument.LongCounterBuildersetUnit(java.lang.String unit)Sets the unit of measure for this instrument.
-
-
-
Method Detail
-
setDescription
LongCounterBuilder setDescription(java.lang.String description)
Sets the description for this instrument.- Parameters:
description- The description.- See Also:
- Instrument Description
-
setUnit
LongCounterBuilder setUnit(java.lang.String unit)
Sets the unit of measure for this instrument.- Parameters:
unit- The unit. Instrument units must be 63 or fewer ASCII characters.- See Also:
- Instrument Unit
-
ofDoubles
DoubleCounterBuilder ofDoubles()
Sets the Counter for recordingdoublevalues.
-
build
LongCounter build()
Builds and returns a Counter instrument with the configuration.- Returns:
- The Counter instrument.
-
buildWithCallback
ObservableLongCounter buildWithCallback(java.util.function.Consumer<ObservableLongMeasurement> callback)
Builds an Asynchronous Counter 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
default ObservableLongMeasurement 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
-
-