Package io.opentelemetry.api.metrics
Interface LongUpDownCounterBuilder
public interface LongUpDownCounterBuilder
Builder class for
LongUpDownCounter
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns aLongUpDownCounter
with the desired options.buildWithCallback
(Consumer<ObservableLongMeasurement> callback) Builds this asynchronous instrument with the given callback.Sets the counter for recordingdouble
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.Description strings should follow the instrument description rules: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-description
-
setUnit
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
DoubleUpDownCounterBuilder ofDoubles()Sets the counter for recordingdouble
values. -
build
LongUpDownCounter build()Builds and returns aLongUpDownCounter
with the desired options.- Returns:
- a
LongUpDownCounter
with the desired options.
-
buildWithCallback
Builds this asynchronous instrument with the given callback.The callback will only be called when the
Meter
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 state-capturing callback used to observe values on-demand.
-