- 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 [alex@erudika.com]
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetrics.ContextAn 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 StringSYSTEM_METRICS_NAMEThe name of the default system @{link MetricRegistry}.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.codahale.metrics.Countercounter(String appid, Class<?> clazz, String... names)Creates a new counter for a particular class and method for a specific application.static StringgetClassName(Class<?> clazz)static Metrics.Contexttime(String appid, Class<?> clazz, String... names)Instantiate timing of a particular class and method for a specific application.
-
-
-
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 requestclazz- the Class to be timednames- 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 requestclazz- the Class to be countednames- one or more unique names to identify the counter - usually a method name- Returns:
- a counter
-
-