Class Metrics

java.lang.Object
com.erudika.para.core.metrics.Metrics

public final class Metrics extends Object
Helper methods for working with performance metrics.
Author:
Alex Bogdanovski [[email protected]]
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    An auto-closeable class that manages timers for both the overall system as well as specific application.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the default system @{link MetricRegistry}.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.codahale.metrics.Counter
    counter(String appid, Class<?> clazz, String... names)
    Creates a new counter for a particular class and method for a specific application.
    static String
    getClassName(Class<?> clazz)
     
    time(String appid, Class<?> clazz, String... names)
    Instantiate timing of a particular class and method for a specific application.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SYSTEM_METRICS_NAME

      public static final String SYSTEM_METRICS_NAME
      The name of the default system @{link MetricRegistry}.
      See Also:
  • Method Details

    • time

      public static Metrics.Context time(String appid, Class<?> clazz, String... names)
      Instantiate timing of a particular class and method for a specific application.
      Parameters:
      appid - the application that invoked the request
      clazz - the Class to be timed
      names - one or more unique names to identify the timer - usually a method name
      Returns:
      a closeable context that encapsulates the timed method
    • counter

      public static com.codahale.metrics.Counter counter(String appid, Class<?> clazz, String... names)
      Creates a new counter for a particular class and method for a specific application.
      Parameters:
      appid - the application that invoked the request
      clazz - the Class to be counted
      names - one or more unique names to identify the counter - usually a method name
      Returns:
      a counter
    • getClassName

      public static String getClassName(Class<?> clazz)