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 RegisteredReaderprivate longprivate final InstrumentationScopeInfoprivate final InstrumentDescriptorprivate static final Loggerprivate final MutableMeasurementOnly used whenactiveReader's memoryMode isMemoryMode.REUSABLE_DATA.private longprivate final List<AsynchronousMetricStorage<?, ?>> private final ThrottlingLogger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSdkObservableMeasurement(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, List<AsynchronousMetricStorage<?, ?>> storages) -
Method Summary
Modifier and TypeMethodDescriptionstatic SdkObservableMeasurementcreate(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, List<AsynchronousMetricStorage<?, ?>> storages) Create aSdkObservableMeasurement.private voiddoRecord(Measurement measurement) Get the instrumentation scope info.(package private) InstrumentDescriptor(package private) List<AsynchronousMetricStorage<?, ?>> private voidvoidrecord(double value) Records a measurement.voidrecord(double value, Attributes attributes) Records a measurement with a set of attributes.voidrecord(long value) Records a measurement.voidrecord(long value, Attributes attributes) Records a measurement with a set of attributes.voidsetActiveReader(RegisteredReader registeredReader, long startEpochNanos, long epochNanos) Set the active reader, and clock information.voidUnset 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:ObservableLongMeasurementRecords a measurement.- Specified by:
recordin interfaceObservableLongMeasurement- Parameters:
value- The measurement value.
-
record
Description copied from interface:ObservableLongMeasurementRecords a measurement with a set of attributes.- Specified by:
recordin 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:ObservableDoubleMeasurementRecords a measurement.- Specified by:
recordin interfaceObservableDoubleMeasurement- Parameters:
value- The measurement value.
-
record
Description copied from interface:ObservableDoubleMeasurementRecords a measurement with a set of attributes.- Specified by:
recordin interfaceObservableDoubleMeasurement- Parameters:
value- The measurement value.attributes- A set of attributes to associate with the value.
-
doRecord
-
logNoActiveReader
private void logNoActiveReader()
-