Class SdkObservableMeasurement
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.internal.state.SdkObservableMeasurement
-
- All Implemented Interfaces:
ObservableDoubleMeasurement
,ObservableLongMeasurement
,ObservableMeasurement
public final class SdkObservableMeasurement extends java.lang.Object implements ObservableLongMeasurement, ObservableDoubleMeasurement
Records values from asynchronous instruments to associatedAsynchronousMetricStorage
.This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private RegisteredReader
activeReader
private long
epochNanos
private InstrumentationScopeInfo
instrumentationScopeInfo
private InstrumentDescriptor
instrumentDescriptor
private static java.util.logging.Logger
logger
private MutableMeasurement
mutableMeasurement
Only used whenactiveReader
's memoryMode isMemoryMode.REUSABLE_DATA
.private long
startEpochNanos
private java.util.List<AsynchronousMetricStorage<?,?>>
storages
private ThrottlingLogger
throttlingLogger
-
Constructor Summary
Constructors Modifier Constructor Description private
SdkObservableMeasurement(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, java.util.List<AsynchronousMetricStorage<?,?>> storages)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SdkObservableMeasurement
create(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, java.util.List<AsynchronousMetricStorage<?,?>> storages)
Create aSdkObservableMeasurement
.private void
doRecord(Measurement measurement)
InstrumentationScopeInfo
getInstrumentationScopeInfo()
Get the instrumentation scope info.(package private) InstrumentDescriptor
getInstrumentDescriptor()
(package private) java.util.List<AsynchronousMetricStorage<?,?>>
getStorages()
private void
logNoActiveReader()
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
unsetActiveReader()
Unset the active reader.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
throttlingLogger
private final ThrottlingLogger throttlingLogger
-
instrumentationScopeInfo
private final InstrumentationScopeInfo instrumentationScopeInfo
-
instrumentDescriptor
private final InstrumentDescriptor instrumentDescriptor
-
storages
private final java.util.List<AsynchronousMetricStorage<?,?>> storages
-
mutableMeasurement
private final MutableMeasurement mutableMeasurement
Only used whenactiveReader
's memoryMode isMemoryMode.REUSABLE_DATA
.
-
activeReader
@Nullable private volatile RegisteredReader activeReader
-
startEpochNanos
private volatile long startEpochNanos
-
epochNanos
private volatile long epochNanos
-
-
Constructor Detail
-
SdkObservableMeasurement
private SdkObservableMeasurement(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, java.util.List<AsynchronousMetricStorage<?,?>> storages)
-
-
Method Detail
-
create
public static SdkObservableMeasurement create(InstrumentationScopeInfo instrumentationScopeInfo, InstrumentDescriptor instrumentDescriptor, java.util.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
public InstrumentationScopeInfo 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
java.util.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
public void record(long value, Attributes attributes)
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
public void record(double value, Attributes attributes)
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
private void doRecord(Measurement measurement)
-
logNoActiveReader
private void logNoActiveReader()
-
-