Package io.opencensus.implcore.metrics
Class DoubleGaugeImpl
- java.lang.Object
-
- io.opencensus.metrics.DoubleGauge
-
- io.opencensus.implcore.metrics.DoubleGaugeImpl
-
- All Implemented Interfaces:
Meter
public final class DoubleGaugeImpl extends DoubleGauge implements Meter
Implementation ofDoubleGauge
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DoubleGaugeImpl.PointImpl
Implementation ofDoubleGauge.DoublePoint
.-
Nested classes/interfaces inherited from class io.opencensus.metrics.DoubleGauge
DoubleGauge.DoublePoint
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LabelValue>
constantLabelValues
private java.util.List<LabelValue>
defaultLabelValues
private int
labelKeysSize
private MetricDescriptor
metricDescriptor
private java.util.Map<java.util.List<LabelValue>,DoubleGaugeImpl.PointImpl>
registeredPoints
(package private) static LabelValue
UNSET_VALUE
-
Constructor Summary
Constructors Constructor Description DoubleGaugeImpl(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys, java.util.Map<LabelKey,LabelValue> constantLabels)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes allTimeSeries
from the gauge metric.DoubleGauge.DoublePoint
getDefaultTimeSeries()
Returns aDoublePoint
for a gauge with all labels not set, or default labels.Metric
getMetric(Clock clock)
Provides aMetric
with one or moreTimeSeries
.MetricDescriptor
getMetricDescriptor()
Provides aMetricDescriptor
.DoubleGauge.DoublePoint
getOrCreateTimeSeries(java.util.List<LabelValue> labelValues)
Creates aTimeSeries
and returns aDoublePoint
if the specifiedlabelValues
is not already associated with this gauge, else returns an existingDoublePoint
.private DoubleGauge.DoublePoint
registerTimeSeries(java.util.List<LabelValue> labelValues)
void
removeTimeSeries(java.util.List<LabelValue> labelValues)
Removes theTimeSeries
from the gauge metric, if it is present.
-
-
-
Field Detail
-
UNSET_VALUE
static final LabelValue UNSET_VALUE
-
metricDescriptor
private final MetricDescriptor metricDescriptor
-
registeredPoints
private volatile java.util.Map<java.util.List<LabelValue>,DoubleGaugeImpl.PointImpl> registeredPoints
-
labelKeysSize
private final int labelKeysSize
-
defaultLabelValues
private final java.util.List<LabelValue> defaultLabelValues
-
constantLabelValues
private final java.util.List<LabelValue> constantLabelValues
-
-
Constructor Detail
-
DoubleGaugeImpl
DoubleGaugeImpl(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys, java.util.Map<LabelKey,LabelValue> constantLabels)
-
-
Method Detail
-
getOrCreateTimeSeries
public DoubleGauge.DoublePoint getOrCreateTimeSeries(java.util.List<LabelValue> labelValues)
Description copied from class:DoubleGauge
Creates aTimeSeries
and returns aDoublePoint
if the specifiedlabelValues
is not already associated with this gauge, else returns an existingDoublePoint
.It is recommended to keep a reference to the DoublePoint instead of always calling this method for manual operations.
- Specified by:
getOrCreateTimeSeries
in classDoubleGauge
- Parameters:
labelValues
- the list of label values. The number of label values must be the same to that of the label keys passed toMetricRegistry.addDoubleGauge(java.lang.String, java.lang.String, java.lang.String, java.util.List<io.opencensus.metrics.LabelKey>)
.- Returns:
- a
DoublePoint
the value of single gauge.
-
getDefaultTimeSeries
public DoubleGauge.DoublePoint getDefaultTimeSeries()
Description copied from class:DoubleGauge
Returns aDoublePoint
for a gauge with all labels not set, or default labels.- Specified by:
getDefaultTimeSeries
in classDoubleGauge
- Returns:
- a
DoublePoint
for a gauge with all labels not set, or default labels.
-
removeTimeSeries
public void removeTimeSeries(java.util.List<LabelValue> labelValues)
Description copied from class:DoubleGauge
Removes theTimeSeries
from the gauge metric, if it is present. i.e. references to previousDoublePoint
objects are invalid (not part of the metric).- Specified by:
removeTimeSeries
in classDoubleGauge
- Parameters:
labelValues
- the list of label values.
-
clear
public void clear()
Description copied from class:DoubleGauge
Removes allTimeSeries
from the gauge metric. i.e. references to all previousDoublePoint
objects are invalid (not part of the metric).- Specified by:
clear
in classDoubleGauge
-
getMetricDescriptor
public MetricDescriptor getMetricDescriptor()
Description copied from interface:Meter
Provides aMetricDescriptor
.- Specified by:
getMetricDescriptor
in interfaceMeter
- Returns:
- a
MetricDescriptor
.
-
registerTimeSeries
private DoubleGauge.DoublePoint registerTimeSeries(java.util.List<LabelValue> labelValues)
-
-