Class TimestampCounter
- java.lang.Object
-
- org.kairosdb.metrics4j.collectors.helpers.Cloneable
-
- org.kairosdb.metrics4j.collectors.impl.TimestampCounter
-
- All Implemented Interfaces:
Serializable,Cloneable,Collector,MetricCollector,TimeCollector,PostConstruct
public class TimestampCounter extends Cloneable implements TimeCollector
This collector records a count of timestamps during a configurable amount of time. The initial use of this collector was to count events going in and out of an event system. The idea is to count all events that occur in a bucket of time and report them using a timestamp within that bucket. The default configuration can handle the same timestamp (rounded to the minute) being reported for just short of 2 weeks (13 ish days) before potentially overwriting the same timestamp when reporting data. Basically a timestamp (rounded to the minute) can be counted and reported for about 2 weeks each time it reports it will use a slightly different timestamp so as to not overwrite previous counts- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected longbucketSizeprotected longincrementFrequency
-
Constructor Summary
Constructors Constructor Description TimestampCounter()TimestampCounter(Clock clock)
-
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(Instant value)Place a double value into the collector to be reported.voidput(Instant time, Instant value)Place a double value and associated timestamp into the collector to be reported.voidreportMetric(MetricReporter metricReporter)voidsetContextProperties(Map<String,String> contextProperties)
-
-
-
Constructor Detail
-
TimestampCounter
public TimestampCounter()
-
TimestampCounter
public TimestampCounter(Clock clock)
-
-
Method Detail
-
put
public void put(Instant value)
Description copied from interface:TimeCollectorPlace a double 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 interfaceTimeCollector- Parameters:
value- Value to be reported.
-
put
public void put(Instant time, Instant value)
Description copied from interface:TimeCollectorPlace a double 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 interfaceTimeCollector- Parameters:
time- Suggested timestamp to use when reporting.value- Value to be reported.
-
clone
public Collector clone()
Description copied from interface:CollectorThe 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.
-
init
public void init(MetricsContext context)
- Specified by:
initin interfacePostConstruct
-
reportMetric
public void reportMetric(MetricReporter metricReporter)
- Specified by:
reportMetricin interfaceMetricCollector
-
setContextProperties
public void setContextProperties(Map<String,String> contextProperties)
- Specified by:
setContextPropertiesin interfaceMetricCollector
-
-