com.aliyun.openservices.shade.io.opentelemetry.api.metrics.LongGaugeBuilder Maven / Gradle / Ivy
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package com.aliyun.openservices.shade.com.aliyun.openservices.shade.io.opentelemetry.api.metrics;
import java.util.function.Consumer;
/** A builder for Gauge metric types. These can only be asynchronously collected. */
public interface LongGaugeBuilder {
/**
* 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
*/
LongGaugeBuilder setDescription(String description);
/**
* 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
*/
LongGaugeBuilder setUnit(String unit);
/**
* Builds this asynchronous instrument with the given callback.
*
*
The callback will only be called when the {@link 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.
*
*
* @param callback A state-capturing callback used to observe values on-demand.
*/
ObservableLongGauge buildWithCallback(Consumer callback);
}