Package io.opentelemetry.sdk.metrics
Class SdkLongUpDownCounter.SdkLongUpDownCounterBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.SdkLongUpDownCounter.SdkLongUpDownCounterBuilder
-
- All Implemented Interfaces:
ExtendedLongUpDownCounterBuilder,LongUpDownCounterBuilder
- Enclosing class:
- SdkLongUpDownCounter
static final class SdkLongUpDownCounter.SdkLongUpDownCounterBuilder extends java.lang.Object implements ExtendedLongUpDownCounterBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private InstrumentBuilderbuilder
-
Constructor Summary
Constructors Constructor Description SdkLongUpDownCounterBuilder(SdkMeter sdkMeter, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LongUpDownCounterbuild()Builds and returns an UpDownCounter instrument with the configuration.ObservableLongMeasurementbuildObserver()Build an observer for this instrument to observe values from aBatchCallback.ObservableLongUpDownCounterbuildWithCallback(java.util.function.Consumer<ObservableLongMeasurement> callback)Builds an Asynchronous UpDownCounter instrument with the given callback.DoubleUpDownCounterBuilderofDoubles()Sets the Counter for recordingdoublevalues.ExtendedLongUpDownCounterBuildersetAttributesAdvice(java.util.List<AttributeKey<?>> attributes)Specify the attribute advice, which suggests the recommended set of attribute keys to be used for this up down counter.LongUpDownCounterBuildersetDescription(java.lang.String description)Sets the description for this instrument.LongUpDownCounterBuildersetUnit(java.lang.String unit)Sets the unit of measure for this instrument.java.lang.StringtoString()
-
-
-
Field Detail
-
builder
private final InstrumentBuilder builder
-
-
Constructor Detail
-
SdkLongUpDownCounterBuilder
SdkLongUpDownCounterBuilder(SdkMeter sdkMeter, java.lang.String name)
-
-
Method Detail
-
setDescription
public LongUpDownCounterBuilder setDescription(java.lang.String description)
Description copied from interface:LongUpDownCounterBuilderSets the description for this instrument.- Specified by:
setDescriptionin interfaceLongUpDownCounterBuilder- Parameters:
description- The description.- See Also:
- Instrument Description
-
setUnit
public LongUpDownCounterBuilder setUnit(java.lang.String unit)
Description copied from interface:LongUpDownCounterBuilderSets the unit of measure for this instrument.- Specified by:
setUnitin interfaceLongUpDownCounterBuilder- Parameters:
unit- The unit. Instrument units must be 63 or fewer ASCII characters.- See Also:
- Instrument Unit
-
build
public LongUpDownCounter build()
Description copied from interface:LongUpDownCounterBuilderBuilds and returns an UpDownCounter instrument with the configuration.- Specified by:
buildin interfaceLongUpDownCounterBuilder- Returns:
- The UpDownCounter instrument.
-
ofDoubles
public DoubleUpDownCounterBuilder ofDoubles()
Description copied from interface:LongUpDownCounterBuilderSets the Counter for recordingdoublevalues.- Specified by:
ofDoublesin interfaceLongUpDownCounterBuilder
-
buildWithCallback
public ObservableLongUpDownCounter buildWithCallback(java.util.function.Consumer<ObservableLongMeasurement> callback)
Description copied from interface:LongUpDownCounterBuilderBuilds 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.
- Specified by:
buildWithCallbackin interfaceLongUpDownCounterBuilder- Parameters:
callback- A callback which observes measurements when invoked.
-
buildObserver
public ObservableLongMeasurement buildObserver()
Description copied from interface:LongUpDownCounterBuilderBuild 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.- Specified by:
buildObserverin interfaceLongUpDownCounterBuilder- Returns:
- an observable measurement that batch callbacks use to observe values.
-
setAttributesAdvice
public ExtendedLongUpDownCounterBuilder setAttributesAdvice(java.util.List<AttributeKey<?>> attributes)
Description copied from interface:ExtendedLongUpDownCounterBuilderSpecify the attribute advice, which suggests the recommended set of attribute keys to be used for this up down counter.- Specified by:
setAttributesAdvicein interfaceExtendedLongUpDownCounterBuilder
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-