Class LongCounter
- java.lang.Object
-
- org.kairosdb.metrics4j.collectors.impl.LongCounter
-
- All Implemented Interfaces:
Serializable,Collector,LongCollector,MetricCollector,PostConstruct
public class LongCounter extends Object implements LongCollector
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AtomicLongm_countprotected booleanreportZeroprotected booleanreset
-
Constructor Summary
Constructors Constructor Description LongCounter()LongCounter(boolean reset, boolean reportZero)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collectorclone()The first instance of a collector is unmarshalled from configuration using hocon, all other instances are cloned from that first one so the clone method should pass along any configuration that was set.voidinit(MetricsContext context)voidput(long count)Place a long value into the collector to be reported.voidput(Instant time, long count)Place a long value and associated timestamp into the collector to be reported.voidreportMetric(MetricReporter metricReporter)voidsetContextProperties(Map<String,String> contextProperties)
-
-
-
Field Detail
-
m_count
protected final AtomicLong m_count
-
reset
protected boolean reset
-
reportZero
protected boolean reportZero
-
-
Method Detail
-
put
public void put(long count)
Description copied from interface:LongCollectorPlace a long value into the collector to be reported. The actual value reported is determined by the collector implementation that is configured for this source.- Specified by:
putin interfaceLongCollector- Parameters:
count- Value to be reported.
-
put
public void put(Instant time, long count)
Description copied from interface:LongCollectorPlace a long value and associated timestamp into the collector to be reported. The actual value and time reported is determined by the collector implementation that is configured for this source.- Specified by:
putin interfaceLongCollector- Parameters:
time- Suggested timestamp to use when reporting.count- Value to be reported.
-
reportMetric
public void reportMetric(MetricReporter metricReporter)
- Specified by:
reportMetricin interfaceMetricCollector
-
setContextProperties
public void setContextProperties(Map<String,String> contextProperties)
- Specified by:
setContextPropertiesin interfaceMetricCollector
-
init
public void init(MetricsContext context)
- Specified by:
initin interfacePostConstruct
-
-