Class MetricSet

  • All Implemented Interfaces:
    Recyclable

    public class MetricSet
    extends java.lang.Object
    implements Recyclable
    A metric set is a collection of metrics which have the same labels.

    A metric set corresponds to one document per metrics_interval in Elasticsearch. An alternative would be to have one document per metric but having one document for all metrics with the same labels saves disk space.

    Example of some serialized metric sets:
     {"metricset":{"timestamp":1545047730692000,"samples":{"jvm.gc.alloc":{"value":24089200.0}}}}
     {"metricset":{"timestamp":1545047730692000,"tags":{"name":"G1 Young Generation"},"samples":{"jvm.gc.time":{"value":0.0},"jvm.gc.count":{"value":0.0}}}}
     {"metricset":{"timestamp":1545047730692000,"tags":{"name":"G1 Old Generation"},  "samples":{"jvm.gc.time":{"value":0.0},"jvm.gc.count":{"value":0.0}}}}
     
    • Method Detail

      • getLabels

        public Labels getLabels()
      • getGauges

        public java.util.concurrent.ConcurrentMap<java.lang.String,​DoubleSupplier> getGauges()
      • timer

        public Timer timer​(java.lang.String timerName)
      • incrementCounter

        public void incrementCounter​(java.lang.String name)
      • getTimers

        public java.util.Map<java.lang.String,​Timer> getTimers()
      • hasContent

        public boolean hasContent()
      • resetState

        public void resetState()
        Should be called only when the MetricSet is inactive
        Specified by:
        resetState in interface Recyclable
      • getCounters

        public java.util.Map<java.lang.String,​java.util.concurrent.atomic.AtomicLong> getCounters()