Package io.opencensus.implcore.metrics
Class DerivedLongGaugeImpl
- java.lang.Object
-
- io.opencensus.metrics.DerivedLongGauge
-
- io.opencensus.implcore.metrics.DerivedLongGaugeImpl
-
- All Implemented Interfaces:
Meter
public final class DerivedLongGaugeImpl extends DerivedLongGauge implements Meter
Implementation ofDerivedLongGauge.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDerivedLongGaugeImpl.PointWithFunction<T>Implementation ofDerivedLongGaugeImpl.PointWithFunctionwith an object and a callback function.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LabelValue>constantLabelValuesprivate intlabelKeysSizeprivate MetricDescriptormetricDescriptorprivate java.util.Map<java.util.List<LabelValue>,DerivedLongGaugeImpl.PointWithFunction<?>>registeredPoints
-
Constructor Summary
Constructors Constructor Description DerivedLongGaugeImpl(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.<T> voidcreateTimeSeries(java.util.List<LabelValue> labelValues, T obj, ToLongFunction<T> function)Creates aTimeSeries.MetricgetMetric(Clock clock)Provides aMetricwith one or moreTimeSeries.MetricDescriptorgetMetricDescriptor()Provides aMetricDescriptor.voidremoveTimeSeries(java.util.List<LabelValue> labelValues)Removes theTimeSeriesfrom the gauge 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
-
registeredPoints
private volatile java.util.Map<java.util.List<LabelValue>,DerivedLongGaugeImpl.PointWithFunction<?>> registeredPoints
-
-
Constructor Detail
-
DerivedLongGaugeImpl
DerivedLongGaugeImpl(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
-
createTimeSeries
public <T> void createTimeSeries(java.util.List<LabelValue> labelValues, @Nullable T obj, ToLongFunction<T> function)
Description copied from class:DerivedLongGaugeCreates 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 aWeakReferenceto the object and it is the user's responsibility to manage the lifetime of the object.- Specified by:
createTimeSeriesin classDerivedLongGauge- 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:DerivedLongGaugeRemoves theTimeSeriesfrom the gauge metric, if it is present.- Specified by:
removeTimeSeriesin classDerivedLongGauge- Parameters:
labelValues- the list of label values.
-
clear
public void clear()
Description copied from class:DerivedLongGaugeRemoves allTimeSeriesfrom the gauge metric.- Specified by:
clearin classDerivedLongGauge
-
getMetricDescriptor
public MetricDescriptor getMetricDescriptor()
Description copied from interface:MeterProvides aMetricDescriptor.- Specified by:
getMetricDescriptorin interfaceMeter- Returns:
- a
MetricDescriptor.
-
-