Package io.opencensus.implcore.metrics
Class DerivedDoubleCumulativeImpl
- java.lang.Object
-
- io.opencensus.metrics.DerivedDoubleCumulative
-
- io.opencensus.implcore.metrics.DerivedDoubleCumulativeImpl
-
- All Implemented Interfaces:
Meter
public final class DerivedDoubleCumulativeImpl extends DerivedDoubleCumulative implements Meter
Implementation ofDerivedDoubleCumulative
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DerivedDoubleCumulativeImpl.PointWithFunction<T>
Implementation ofDerivedDoubleCumulativeImpl.PointWithFunction
with an object and a callback function.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LabelValue>
constantLabelValues
private int
labelKeysSize
private MetricDescriptor
metricDescriptor
private java.util.Map<java.util.List<LabelValue>,DerivedDoubleCumulativeImpl.PointWithFunction<?>>
registeredPoints
private Timestamp
startTime
-
Constructor Summary
Constructors Constructor Description DerivedDoubleCumulativeImpl(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys, java.util.Map<LabelKey,LabelValue> constantLabels, Timestamp startTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes allTimeSeries
from the cumulative metric.<T> void
createTimeSeries(java.util.List<LabelValue> labelValues, T obj, ToDoubleFunction<T> function)
Creates aTimeSeries
.Metric
getMetric(Clock clock)
Provides aMetric
with one or moreTimeSeries
.MetricDescriptor
getMetricDescriptor()
Provides aMetricDescriptor
.void
removeTimeSeries(java.util.List<LabelValue> labelValues)
Removes theTimeSeries
from the cumulative metric, if it is present.
-
-
-
Field Detail
-
metricDescriptor
private final MetricDescriptor metricDescriptor
-
labelKeysSize
private final int labelKeysSize
-
constantLabelValues
private final java.util.List<LabelValue> constantLabelValues
-
startTime
private final Timestamp startTime
-
registeredPoints
private volatile java.util.Map<java.util.List<LabelValue>,DerivedDoubleCumulativeImpl.PointWithFunction<?>> registeredPoints
-
-
Constructor Detail
-
DerivedDoubleCumulativeImpl
DerivedDoubleCumulativeImpl(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys, java.util.Map<LabelKey,LabelValue> constantLabels, Timestamp startTime)
-
-
Method Detail
-
createTimeSeries
public <T> void createTimeSeries(java.util.List<LabelValue> labelValues, @Nullable T obj, ToDoubleFunction<T> function)
Description copied from class:DerivedDoubleCumulative
Creates aTimeSeries
. The value of a single point in the TimeSeries is observed from a callback function. This function is invoked whenever metrics are collected, meaning the reported value is up-to-date. It keeps aWeakReference
to the object and it is the user's responsibility to manage the lifetime of the object.- Specified by:
createTimeSeries
in classDerivedDoubleCumulative
- Type Parameters:
T
- the type of the object upon which the function derives a measurement.- Parameters:
labelValues
- the list of label values.obj
- the state object from which the function derives a measurement.function
- the function to be called.
-
removeTimeSeries
public void removeTimeSeries(java.util.List<LabelValue> labelValues)
Description copied from class:DerivedDoubleCumulative
Removes theTimeSeries
from the cumulative metric, if it is present.- Specified by:
removeTimeSeries
in classDerivedDoubleCumulative
- Parameters:
labelValues
- the list of label values.
-
clear
public void clear()
Description copied from class:DerivedDoubleCumulative
Removes allTimeSeries
from the cumulative metric.- Specified by:
clear
in classDerivedDoubleCumulative
-
getMetricDescriptor
public MetricDescriptor getMetricDescriptor()
Description copied from interface:Meter
Provides aMetricDescriptor
.- Specified by:
getMetricDescriptor
in interfaceMeter
- Returns:
- a
MetricDescriptor
.
-
-