Class SdkObservableMeasurement
java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.SdkObservableMeasurement
- All Implemented Interfaces:
ObservableDoubleMeasurement
,ObservableLongMeasurement
,ObservableMeasurement
public final class SdkObservableMeasurement
extends Object
implements ObservableLongMeasurement, ObservableDoubleMeasurement
Records values from asynchronous instruments to associated
AsynchronousMetricStorage
.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RegisteredReader
private long
private final InstrumentationScopeInfo
private final InstrumentDescriptor
private static final Logger
private final MutableMeasurement
Only used whenactiveReader
's memoryMode isMemoryMode.REUSABLE_DATA
.private long
private final List
<AsynchronousMetricStorage<?, ?>> private final ThrottlingLogger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SdkObservableMeasurement
(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, List<AsynchronousMetricStorage<?, ?>> storages) -
Method Summary
Modifier and TypeMethodDescriptionstatic SdkObservableMeasurement
create
(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, List<AsynchronousMetricStorage<?, ?>> storages) Create aSdkObservableMeasurement
.private void
doRecord
(Measurement measurement) Get the instrumentation scope info.(package private) InstrumentDescriptor
(package private) List
<AsynchronousMetricStorage<?, ?>> private void
void
record
(double value) Records a measurement.void
record
(double value, Attributes attributes) Records a measurement with a set of attributes.void
record
(long value) Records a measurement.void
record
(long value, Attributes attributes) Records a measurement with a set of attributes.void
setActiveReader
(RegisteredReader registeredReader, long startEpochNanos, long epochNanos) Set the active reader, and clock information.void
Unset the active reader.
-
Field Details
-
logger
-
throttlingLogger
-
instrumentationScopeInfo
-
instrumentDescriptor
-
storages
-
mutableMeasurement
Only used whenactiveReader
's memoryMode isMemoryMode.REUSABLE_DATA
. -
activeReader
-
startEpochNanos
private volatile long startEpochNanos -
epochNanos
private volatile long epochNanos
-
-
Constructor Details
-
SdkObservableMeasurement
private SdkObservableMeasurement(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, List<AsynchronousMetricStorage<?, ?>> storages)
-
-
Method Details
-
create
public static SdkObservableMeasurement create(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, List<AsynchronousMetricStorage<?, ?>> storages) Create aSdkObservableMeasurement
.- Parameters:
instrumentationScopeInfo
- the instrumentation scope info of corresponding meterinstrumentDescriptor
- the instrument descriptorstorages
- the storages to record to- Returns:
- the observable measurement
-
getInstrumentationScopeInfo
Get the instrumentation scope info. -
setActiveReader
public void setActiveReader(RegisteredReader registeredReader, long startEpochNanos, long epochNanos) Set the active reader, and clock information.unsetActiveReader()
MUST be called after. -
unsetActiveReader
public void unsetActiveReader()Unset the active reader. Called aftersetActiveReader(RegisteredReader, long, long)
. -
getInstrumentDescriptor
InstrumentDescriptor getInstrumentDescriptor() -
getStorages
List<AsynchronousMetricStorage<?,?>> getStorages() -
record
public void record(long value) Description copied from interface:ObservableLongMeasurement
Records a measurement.- Specified by:
record
in interfaceObservableLongMeasurement
- Parameters:
value
- The measurement value.
-
record
Description copied from interface:ObservableLongMeasurement
Records a measurement with a set of attributes.- Specified by:
record
in interfaceObservableLongMeasurement
- Parameters:
value
- The measurement value.attributes
- A set of attributes to associate with the value.
-
record
public void record(double value) Description copied from interface:ObservableDoubleMeasurement
Records a measurement.- Specified by:
record
in interfaceObservableDoubleMeasurement
- Parameters:
value
- The measurement value.
-
record
Description copied from interface:ObservableDoubleMeasurement
Records a measurement with a set of attributes.- Specified by:
record
in interfaceObservableDoubleMeasurement
- Parameters:
value
- The measurement value.attributes
- A set of attributes to associate with the value.
-
doRecord
-
logNoActiveReader
private void logNoActiveReader()
-