Class 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 Detail

      • incrementFrequency

        protected long incrementFrequency
      • bucketSize

        protected long bucketSize
    • Constructor Detail

      • TimestampCounter

        public TimestampCounter()
      • TimestampCounter

        public TimestampCounter​(Clock clock)
    • Method Detail

      • put

        public void put​(Instant value)
        Description copied from interface: TimeCollector
        Place 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:
        put in interface TimeCollector
        Parameters:
        value - Value to be reported.
      • put

        public void put​(Instant time,
                        Instant value)
        Description copied from interface: TimeCollector
        Place 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:
        put in interface TimeCollector
        Parameters:
        time - Suggested timestamp to use when reporting.
        value - Value to be reported.
      • clone

        public Collector clone()
        Description copied from interface: Collector
        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.
        Specified by:
        clone in interface Collector
        Overrides:
        clone in class Cloneable
        Returns:
        Clone of this collector