Package io.opencensus.implcore.metrics
Class DerivedLongCumulativeImpl
java.lang.Object
io.opencensus.metrics.DerivedLongCumulative
io.opencensus.implcore.metrics.DerivedLongCumulativeImpl
- All Implemented Interfaces:
Meter
Implementation of
DerivedLongCumulative
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Implementation ofDerivedLongCumulativeImpl.PointWithFunction
with an object and a callback function. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<LabelValue> private final int
private final MetricDescriptor
private Map
<List<LabelValue>, DerivedLongCumulativeImpl.PointWithFunction<?>> private final Timestamp
-
Constructor Summary
ConstructorsConstructorDescriptionDerivedLongCumulativeImpl
(String name, String description, String unit, List<LabelKey> labelKeys, Map<LabelKey, LabelValue> constantLabels, Timestamp startTime) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes allTimeSeries
from the cumulative metric.<T> void
createTimeSeries
(List<LabelValue> labelValues, T obj, ToLongFunction<T> function) Creates aTimeSeries
.Provides aMetric
with one or moreTimeSeries
.Provides aMetricDescriptor
.void
removeTimeSeries
(List<LabelValue> labelValues) Removes theTimeSeries
from the cumulative metric, if it is present.
-
Field Details
-
metricDescriptor
-
labelKeysSize
private final int labelKeysSize -
constantLabelValues
-
startTime
-
registeredPoints
private volatile Map<List<LabelValue>,DerivedLongCumulativeImpl.PointWithFunction<?>> registeredPoints
-
-
Constructor Details
-
DerivedLongCumulativeImpl
-
-
Method Details
-
createTimeSeries
public <T> void createTimeSeries(List<LabelValue> labelValues, @Nullable T obj, ToLongFunction<T> function) Description copied from class:DerivedLongCumulative
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 classDerivedLongCumulative
- 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
Description copied from class:DerivedLongCumulative
Removes theTimeSeries
from the cumulative metric, if it is present.- Specified by:
removeTimeSeries
in classDerivedLongCumulative
- Parameters:
labelValues
- the list of label values.
-
clear
public void clear()Description copied from class:DerivedLongCumulative
Removes allTimeSeries
from the cumulative metric.- Specified by:
clear
in classDerivedLongCumulative
-
getMetricDescriptor
Description copied from interface:Meter
Provides aMetricDescriptor
.- Specified by:
getMetricDescriptor
in interfaceMeter
- Returns:
- a
MetricDescriptor
.
-
getMetric
Description copied from interface:Meter
Provides aMetric
with one or moreTimeSeries
.
-