Package io.opentelemetry.sdk.metrics
Class SdkLongCounter.SdkLongCounterBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.SdkLongCounter.SdkLongCounterBuilder
-
- All Implemented Interfaces:
ExtendedLongCounterBuilder,LongCounterBuilder
- Enclosing class:
- SdkLongCounter
static final class SdkLongCounter.SdkLongCounterBuilder extends java.lang.Object implements ExtendedLongCounterBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private InstrumentBuilderbuilder
-
Constructor Summary
Constructors Constructor Description SdkLongCounterBuilder(SdkMeter sdkMeter, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SdkLongCounterbuild()Builds and returns a Counter instrument with the configuration.ObservableLongMeasurementbuildObserver()Build an observer for this instrument to observe values from aBatchCallback.ObservableLongCounterbuildWithCallback(java.util.function.Consumer<ObservableLongMeasurement> callback)Builds an Asynchronous Counter instrument with the given callback.DoubleCounterBuilderofDoubles()Sets the Counter for recordingdoublevalues.ExtendedLongCounterBuildersetAttributesAdvice(java.util.List<AttributeKey<?>> attributes)Specify the attribute advice, which suggests the recommended set of attribute keys to be used for this counter.LongCounterBuildersetDescription(java.lang.String description)Sets the description for this instrument.LongCounterBuildersetUnit(java.lang.String unit)Sets the unit of measure for this instrument.java.lang.StringtoString()
-
-
-
Field Detail
-
builder
private final InstrumentBuilder builder
-
-
Constructor Detail
-
SdkLongCounterBuilder
SdkLongCounterBuilder(SdkMeter sdkMeter, java.lang.String name)
-
-
Method Detail
-
setDescription
public LongCounterBuilder setDescription(java.lang.String description)
Description copied from interface:LongCounterBuilderSets the description for this instrument.- Specified by:
setDescriptionin interfaceLongCounterBuilder- Parameters:
description- The description.- See Also:
- Instrument Description
-
setUnit
public LongCounterBuilder setUnit(java.lang.String unit)
Description copied from interface:LongCounterBuilderSets the unit of measure for this instrument.- Specified by:
setUnitin interfaceLongCounterBuilder- Parameters:
unit- The unit. Instrument units must be 63 or fewer ASCII characters.- See Also:
- Instrument Unit
-
build
public SdkLongCounter build()
Description copied from interface:LongCounterBuilderBuilds and returns a Counter instrument with the configuration.- Specified by:
buildin interfaceLongCounterBuilder- Returns:
- The Counter instrument.
-
ofDoubles
public DoubleCounterBuilder ofDoubles()
Description copied from interface:LongCounterBuilderSets the Counter for recordingdoublevalues.- Specified by:
ofDoublesin interfaceLongCounterBuilder
-
buildWithCallback
public ObservableLongCounter buildWithCallback(java.util.function.Consumer<ObservableLongMeasurement> callback)
Description copied from interface:LongCounterBuilderBuilds an Asynchronous Counter 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 interfaceLongCounterBuilder- Parameters:
callback- A callback which observes measurements when invoked.
-
buildObserver
public ObservableLongMeasurement buildObserver()
Description copied from interface:LongCounterBuilderBuild 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 interfaceLongCounterBuilder- Returns:
- an observable measurement that batch callbacks use to observe values.
-
setAttributesAdvice
public ExtendedLongCounterBuilder setAttributesAdvice(java.util.List<AttributeKey<?>> attributes)
Description copied from interface:ExtendedLongCounterBuilderSpecify the attribute advice, which suggests the recommended set of attribute keys to be used for this counter.- Specified by:
setAttributesAdvicein interfaceExtendedLongCounterBuilder
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-