Top Description Methods
io.opentelemetry.api.metrics

public Interface LongUpDownCounterBuilder

Known Direct Implementers
io.opentelemetry.api.metrics.DefaultMeter.NoopLongUpDownCounterBuilder
Imports
java.util.function.Consumer

Builder class for LongUpDownCounter.
Since
1.10.0

Method Summary

Modifier and TypeMethod and Description
public LongUpDownCounter

Returns:

The UpDownCounter instrument.
build
()

Builds and returns an UpDownCounter instrument with the configuration.

public default ObservableLongMeasurement

Returns:

an observable measurement that batch callbacks use to observe values.
buildObserver
()

Build an observer for this instrument to observe values from a BatchCallback.

public ObservableLongUpDownCounter
buildWithCallback(Consumer<ObservableLongMeasurement>
A callback which observes measurements when invoked.
callback
)

Builds an Asynchronous UpDownCounter instrument with the given callback.

public DoubleUpDownCounterBuilder
ofDoubles()

Sets the Counter for recording double values.

public LongUpDownCounterBuilder
setDescription(String
The description.
description
)

Sets the description for this instrument.

public LongUpDownCounterBuilder
setUnit(String
The unit. Instrument units must be 63 or fewer ASCII characters.
unit
)

Sets the unit of measure for this instrument.

Method Detail

buildback to summary
public LongUpDownCounter build()

Builds and returns an UpDownCounter instrument with the configuration.

Returns:LongUpDownCounter

The UpDownCounter instrument.

buildObserverback to summary
public default ObservableLongMeasurement buildObserver()

Build an observer for this instrument to observe values from a BatchCallback.

This observer MUST be registered when creating a batchCallback, which records to it. Values observed outside registered callbacks are ignored.

Returns:ObservableLongMeasurement

an observable measurement that batch callbacks use to observe values.

Since
1.15.0
buildWithCallbackback to summary
public ObservableLongUpDownCounter buildWithCallback(Consumer<ObservableLongMeasurement> callback)

Builds an Asynchronous UpDownCounter 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:Consumer<ObservableLongMeasurement>

A callback which observes measurements when invoked.

ofDoublesback to summary
public DoubleUpDownCounterBuilder ofDoubles()

Sets the Counter for recording double values.

setDescriptionback to summary
public LongUpDownCounterBuilder setDescription(String description)

Sets the description for this instrument.

Parameters
description:String

The description.

See Also
Instrument Description
setUnitback to summary
public LongUpDownCounterBuilder setUnit(String unit)

Sets the unit of measure for this instrument.

Parameters
unit:String

The unit. Instrument units must be 63 or fewer ASCII characters.

See Also
Instrument Unit