Partilhar via


LongGauge Interface

public interface LongGauge

A counter instrument that records long values.

Counters only allow adding positive values, and guarantee the resulting metrics will be always-increasing monotonic sums.

Method Summary

Modifier and Type Method and Description
abstract boolean isEnabled()

Flag indicating if metric implementation is detected and functional, use it to minimize performance impact associated with metrics, e.g.

abstract AutoCloseable registerCallback(Supplier<Long> valueSupplier, TelemetryAttributes attributes)

Registers callbacks to obtain measurements.

Method Details

isEnabled

public abstract boolean isEnabled()

Flag indicating if metric implementation is detected and functional, use it to minimize performance impact associated with metrics, e.g. measuring latency.

Returns:

true if enabled, false otherwise

registerCallback

public abstract AutoCloseable registerCallback(Supplier valueSupplier, TelemetryAttributes attributes)

Registers callbacks to obtain measurements. Make sure to close result to stop reporting metric.

Parameters:

valueSupplier - Callback that will periodically be requested to obtain current value.
attributes - Collection of attributes representing metric dimensions. Caller that wants to record dynamic attributes, should register callback per each attribute combination.

Returns:

instance of AutoCloseable subscription.

Applies to