Package com.yammer.metrics.core
Class DeltaCounter
- java.lang.Object
-
- com.yammer.metrics.core.Counter
-
- com.yammer.metrics.core.DeltaCounter
-
- All Implemented Interfaces:
com.yammer.metrics.core.Metric
public class DeltaCounter extends com.yammer.metrics.core.CounterA counter for Wavefront delta metrics. Differs from a counter in that it is reset every time the value is reported. (This is similar to howWavefrontHistogramis implemented)- Author:
- Suranjan Pramanik (suranjan@wavefront.com)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DeltaCounterget(com.yammer.metrics.core.MetricName metricName)A static factory method to create an instance of DeltaCounter.static DeltaCounterget(com.yammer.metrics.core.MetricsRegistry registry, com.yammer.metrics.core.MetricName metricName)A static factory method to create an instance of Delta Counter.static com.yammer.metrics.core.MetricNamegetDeltaCounterMetricName(com.yammer.metrics.core.MetricName metricName)This method transforms the MetricName into a new MetricName that represents a DeltaCounter.static StringgetDeltaCounterName(String name)A helper function to transform a counter name to a DeltaCounter name.static StringgetNameWithoutDeltaPrefix(String name)A helper function to transform the name from a DeltaCounter name to a new name by removing the "∆" prefix.static booleanisDelta(String name)This method checks whether the name is a valid DeltaCounter name.static longprocessDeltaCounter(DeltaCounter counter)This method returns the current count of the DeltaCounter and resets the counter.
-
-
-
Method Detail
-
get
public static DeltaCounter get(com.yammer.metrics.core.MetricsRegistry registry, com.yammer.metrics.core.MetricName metricName)
A static factory method to create an instance of Delta Counter.- Parameters:
registry- The MetricRegistry to usemetricName- The MetricName to use- Returns:
- An instance of DeltaCounter
-
get
public static DeltaCounter get(com.yammer.metrics.core.MetricName metricName)
A static factory method to create an instance of DeltaCounter. It uses the default MetricsRegistry.- Parameters:
metricName- The MetricName to use- Returns:
- An instance of DeltaCounter
-
processDeltaCounter
public static long processDeltaCounter(DeltaCounter counter)
This method returns the current count of the DeltaCounter and resets the counter.- Parameters:
counter- The DeltaCounter whose value is requested- Returns:
- The current count of the DeltaCounter
-
getDeltaCounterMetricName
public static com.yammer.metrics.core.MetricName getDeltaCounterMetricName(com.yammer.metrics.core.MetricName metricName)
This method transforms the MetricName into a new MetricName that represents a DeltaCounter. The transformation includes prepending a "∆" character to the name.- Parameters:
metricName- The MetricName which needs to be transformed- Returns:
- The new MetricName representing a DeltaCounter
-
getDeltaCounterName
public static String getDeltaCounterName(String name)
A helper function to transform a counter name to a DeltaCounter name. The transformation includes prepending a "∆" character to the name.- Parameters:
name- The name which needs to be transformed- Returns:
- The new name representing a DeltaCounter
-
isDelta
public static boolean isDelta(String name)
This method checks whether the name is a valid DeltaCounter name.- Parameters:
name- The name which needs to be checked- Returns:
- True if the name is a valid DeltaCounter name, otherwise returns false
-
getNameWithoutDeltaPrefix
public static String getNameWithoutDeltaPrefix(String name)
A helper function to transform the name from a DeltaCounter name to a new name by removing the "∆" prefix. If the name is not a DeltaCounter name then the input name is returned.- Parameters:
name- The name which needs to be transformed- Returns:
- The transformed name
-
-