Class DeltaCounter

  • All Implemented Interfaces:
    com.yammer.metrics.core.Metric

    public class DeltaCounter
    extends com.yammer.metrics.core.Counter
    A counter for Wavefront delta metrics. Differs from a counter in that it is reset every time the value is reported. (This is similar to how WavefrontHistogram is implemented)
    Author:
    Suranjan Pramanik (suranjan@wavefront.com)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static DeltaCounter get​(com.yammer.metrics.core.MetricName metricName)
      A static factory method to create an instance of DeltaCounter.
      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.
      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.
      static String getDeltaCounterName​(String name)
      A helper function to transform a counter name to a DeltaCounter name.
      static String getNameWithoutDeltaPrefix​(String name)
      A helper function to transform the name from a DeltaCounter name to a new name by removing the "∆" prefix.
      static boolean isDelta​(String name)
      This method checks whether the name is a valid DeltaCounter name.
      static long processDeltaCounter​(DeltaCounter counter)
      This method returns the current count of the DeltaCounter and resets the counter.
      • Methods inherited from class com.yammer.metrics.core.Counter

        clear, count, dec, dec, inc, inc, processWith
    • 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 use
        metricName - 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