Package io.opencensus.implcore.metrics
Class LongGaugeImpl
- java.lang.Object
-
- io.opencensus.metrics.LongGauge
-
- io.opencensus.implcore.metrics.LongGaugeImpl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLongGaugeImpl.PointImplImplementation ofLongGauge.LongPoint.-
Nested classes/interfaces inherited from class io.opencensus.metrics.LongGauge
LongGauge.LongPoint
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LabelValue>constantLabelValuesprivate java.util.List<LabelValue>defaultLabelValuesprivate intlabelKeysSizeprivate MetricDescriptormetricDescriptorprivate java.util.Map<java.util.List<LabelValue>,LongGaugeImpl.PointImpl>registeredPoints(package private) static LabelValueUNSET_VALUE
-
Constructor Summary
Constructors Constructor Description LongGaugeImpl(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 voidclear()Removes allTimeSeriesfrom the gauge metric.LongGauge.LongPointgetDefaultTimeSeries()Returns aLongPointfor a gauge with all labels not set, or default labels.MetricgetMetric(Clock clock)Provides aMetricwith one or moreTimeSeries.MetricDescriptorgetMetricDescriptor()Provides aMetricDescriptor.LongGauge.LongPointgetOrCreateTimeSeries(java.util.List<LabelValue> labelValues)Creates aTimeSeriesand returns aLongPointif the specifiedlabelValuesis not already associated with this gauge, else returns an existingLongPoint.private LongGauge.LongPointregisterTimeSeries(java.util.List<LabelValue> labelValues)voidremoveTimeSeries(java.util.List<LabelValue> labelValues)Removes theTimeSeriesfrom 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>,LongGaugeImpl.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
-
LongGaugeImpl
LongGaugeImpl(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 LongGauge.LongPoint getOrCreateTimeSeries(java.util.List<LabelValue> labelValues)
Description copied from class:LongGaugeCreates aTimeSeriesand returns aLongPointif the specifiedlabelValuesis not already associated with this gauge, else returns an existingLongPoint.It is recommended to keep a reference to the LongPoint instead of always calling this method for manual operations.
- Specified by:
getOrCreateTimeSeriesin classLongGauge- Parameters:
labelValues- the list of label values. The number of label values must be the same to that of the label keys passed toMetricRegistry.addLongGauge(java.lang.String, java.lang.String, java.lang.String, java.util.List<io.opencensus.metrics.LabelKey>).- Returns:
- a
LongPointthe value of single gauge.
-
getDefaultTimeSeries
public LongGauge.LongPoint getDefaultTimeSeries()
Description copied from class:LongGaugeReturns aLongPointfor a gauge with all labels not set, or default labels.- Specified by:
getDefaultTimeSeriesin classLongGauge- Returns:
- a
LongPointfor a gauge with all labels not set, or default labels.
-
removeTimeSeries
public void removeTimeSeries(java.util.List<LabelValue> labelValues)
Description copied from class:LongGaugeRemoves theTimeSeriesfrom the gauge metric, if it is present. i.e. references to previousLongPointobjects are invalid (not part of the metric).- Specified by:
removeTimeSeriesin classLongGauge- Parameters:
labelValues- the list of label values.
-
clear
public void clear()
Description copied from class:LongGaugeRemoves allTimeSeriesfrom the gauge metric. i.e. references to all previousLongPointobjects are invalid (not part of the metric).
-
getMetricDescriptor
public MetricDescriptor getMetricDescriptor()
Description copied from interface:MeterProvides aMetricDescriptor.- Specified by:
getMetricDescriptorin interfaceMeter- Returns:
- a
MetricDescriptor.
-
registerTimeSeries
private LongGauge.LongPoint registerTimeSeries(java.util.List<LabelValue> labelValues)
-
-