org.apache.storm.metric.internal

## Class MultiLatencyStatAndMetric<T>

- java.lang.Object
- - org.apache.storm.metric.internal.MultiLatencyStatAndMetric<T>

- All Implemented Interfaces:
    IMetric

      public class MultiLatencyStatAndMetric<T>
      extends Object
      implements IMetric

  Acts as a Latnecy Metric for multiple keys, but keeps track of approximate counts for the last 10 mins, 3 hours, 1 day, and all time. for the same keys

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiLatencyStatAndMetric(int numBuckets)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `Map<String,Map<T,Double>>` | `getTimeLatAvg()`
    `Object` | `getValueAndReset()` Get value and reset.
    `protected String` | `keyToString(T key)`
    `void` | `record(T key, long latency)` Record a latency value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MultiLatencyStatAndMetric

          public MultiLatencyStatAndMetric(int numBuckets)

      Constructor.

      Parameters:
        `numBuckets` - the number of buckets to divide the time periods into.

  - ### Method Detail

    - #### record

          public void record(T key,
                             long latency)

      Record a latency value.

      Parameters:
        `latency` - the measurement to record

    - #### keyToString

          protected String keyToString(T key)

    - #### getValueAndReset

          public Object getValueAndReset()

      Description copied from interface: `IMetric`

      Get value and reset.

      Specified by:
        `getValueAndReset` in interface `IMetric`
      Returns:
        an object that will be sent sent to `IMetricsConsumer#handleDataPoints(org.apache.storm.metric.api.IMetricsConsumer .TaskInfo, java.util.Collection)`. If null is returned nothing will be sent. If this value can be reset, like with a counter, a side effect of calling this should be that the value is reset.

    - #### getTimeLatAvg

          public Map<String,Map<T,Double>> getTimeLatAvg()

    - #### close

          public void close()

Copyright © 2019 The Apache Software Foundation. All rights reserved.