Package io.opentelemetry.sdk.metrics
Class SdkDoubleGauge
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.AbstractInstrument
-
- io.opentelemetry.sdk.metrics.SdkDoubleGauge
-
- All Implemented Interfaces:
ExtendedDoubleGauge
,DoubleGauge
final class SdkDoubleGauge extends AbstractInstrument implements ExtendedDoubleGauge
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SdkDoubleGauge.SdkDoubleGaugeBuilder
-
Field Summary
Fields Modifier and Type Field Description private SdkMeter
sdkMeter
private WriteableMetricStorage
storage
-
Constructor Summary
Constructors Modifier Constructor Description private
SdkDoubleGauge(InstrumentDescriptor descriptor, SdkMeter sdkMeter, WriteableMetricStorage storage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isEnabled()
Returnstrue
if the gauge is enabled.void
set(double increment)
Set the gauge value.void
set(double value, Attributes attributes)
Records a value with a set of attributes.void
set(double value, Attributes attributes, Context context)
Records a value with a set of attributes.-
Methods inherited from class io.opentelemetry.sdk.metrics.AbstractInstrument
equals, getDescriptor, hashCode, toString
-
-
-
-
Field Detail
-
sdkMeter
private final SdkMeter sdkMeter
-
storage
private final WriteableMetricStorage storage
-
-
Constructor Detail
-
SdkDoubleGauge
private SdkDoubleGauge(InstrumentDescriptor descriptor, SdkMeter sdkMeter, WriteableMetricStorage storage)
-
-
Method Detail
-
set
public void set(double value, Attributes attributes)
Description copied from interface:DoubleGauge
Records a value with a set of attributes.- Specified by:
set
in interfaceDoubleGauge
- Parameters:
value
- The current gauge value.attributes
- A set of attributes to associate with the value.
-
set
public void set(double value, Attributes attributes, Context context)
Description copied from interface:DoubleGauge
Records a value with a set of attributes.- Specified by:
set
in interfaceDoubleGauge
- Parameters:
value
- The current gauge value.attributes
- A set of attributes to associate with the value.context
- The explicit context to associate with this measurement.
-
set
public void set(double increment)
Description copied from interface:DoubleGauge
Set the gauge value.- Specified by:
set
in interfaceDoubleGauge
- Parameters:
increment
- The current gauge value.
-
isEnabled
public boolean isEnabled()
Description copied from interface:ExtendedDoubleGauge
Returnstrue
if the gauge is enabled.This allows callers to avoid unnecessary compute when nothing is consuming the data. Because the response is subject to change over the application, callers should call this before each call to
DoubleGauge.set(double)
,DoubleGauge.set(double, Attributes)
, orDoubleGauge.set(double, Attributes, Context)
.- Specified by:
isEnabled
in interfaceExtendedDoubleGauge
-
-