Class MetricSnapshot

  • All Implemented Interfaces:
    java.lang.Iterable<java.util.Map.Entry<MetricDimensions,​MetricSet>>

    public final class MetricSnapshot
    extends java.lang.Object
    implements java.lang.Iterable<java.util.Map.Entry<MetricDimensions,​MetricSet>>
    A snapshot of the metrics of this system in a particular time interval.
    Author:
    Simon Thoresen Hult
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MetricSnapshot createSnapshot()
      Create a new snapshot instance where Gauge metrics are preserved with the last-values they have in this snapshot instance.
      long getFromTime​(java.util.concurrent.TimeUnit unit)  
      long getToTime​(java.util.concurrent.TimeUnit unit)  
      java.util.Iterator<java.util.Map.Entry<MetricDimensions,​MetricSet>> iterator()
      Returns all the metrics in this snapshot.
      MetricSet metricSet​(MetricDimensions dim)
      Returns a metric set from this snapshot for a given set of dimensions
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • MetricSnapshot

        public MetricSnapshot​(long from,
                              long to,
                              java.util.concurrent.TimeUnit unit,
                              java.util.Map<MetricDimensions,​MetricSet> data)
    • Method Detail

      • getFromTime

        public long getFromTime​(java.util.concurrent.TimeUnit unit)
      • getToTime

        public long getToTime​(java.util.concurrent.TimeUnit unit)
      • iterator

        public java.util.Iterator<java.util.Map.Entry<MetricDimensions,​MetricSet>> iterator()
        Returns all the metrics in this snapshot.
        Specified by:
        iterator in interface java.lang.Iterable<java.util.Map.Entry<MetricDimensions,​MetricSet>>
      • metricSet

        public MetricSet metricSet​(MetricDimensions dim)
        Returns a metric set from this snapshot for a given set of dimensions
      • createSnapshot

        public MetricSnapshot createSnapshot()
        Create a new snapshot instance where Gauge metrics are preserved with the last-values they have in this snapshot instance.