Class Metrics


  • public final class Metrics
    extends Object
    Helper methods for working with performance metrics.
    Author:
    Alex Bogdanovski [alex@erudika.com]
    • Field Detail

      • SYSTEM_METRICS_NAME

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

      • 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)