Package io.opentelemetry.sdk.metrics
Class SdkLongGauge
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.AbstractInstrument
-
- io.opentelemetry.sdk.metrics.SdkLongGauge
-
- All Implemented Interfaces:
ExtendedLongGauge
,LongGauge
final class SdkLongGauge extends AbstractInstrument implements ExtendedLongGauge
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SdkLongGauge.SdkLongGaugeBuilder
-
Field Summary
Fields Modifier and Type Field Description private SdkMeter
sdkMeter
private WriteableMetricStorage
storage
-
Constructor Summary
Constructors Modifier Constructor Description private
SdkLongGauge(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(long increment)
Set the gauge value.void
set(long value, Attributes attributes)
Records a value with a set of attributes.void
set(long 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
-
SdkLongGauge
private SdkLongGauge(InstrumentDescriptor descriptor, SdkMeter sdkMeter, WriteableMetricStorage storage)
-
-
Method Detail
-
set
public void set(long value, Attributes attributes)
Description copied from interface:LongGauge
Records a value with a set of attributes.
-
set
public void set(long value, Attributes attributes, Context context)
Description copied from interface:LongGauge
Records a value with a set of attributes.
-
set
public void set(long increment)
Description copied from interface:LongGauge
Set the gauge value.
-
isEnabled
public boolean isEnabled()
Description copied from interface:ExtendedLongGauge
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
LongGauge.set(long)
,LongGauge.set(long, Attributes)
, orLongGauge.set(long, Attributes, Context)
.- Specified by:
isEnabled
in interfaceExtendedLongGauge
-
-