Package io.engineblock.metrics
Class ActivityMetrics
- java.lang.Object
-
- io.engineblock.metrics.ActivityMetrics
-
public class ActivityMetrics extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static com.codahale.metrics.MetricFilterMETRIC_FILTER
-
Method Summary
Modifier and Type Method Description static voidaddClassicHistos(java.lang.String sessionName, java.lang.String pattern, java.lang.String prefix, java.lang.String interval)Add a classic histogram in addition to the default implementation in this runtime.static voidaddHistoLogger(java.lang.String sessionName, java.lang.String pattern, java.lang.String filename, java.lang.String interval)Add a histogram interval logger to matching metrics in this JVM instance.static voidaddStatsLogger(java.lang.String sessionName, java.lang.String pattern, java.lang.String filename, java.lang.String interval)Add a histogram stats logger to matching metrics in this JVM instance.static voidcloseMetrics(boolean showChart)This should be called at the end of a process, so that open intervals can be finished, logs closed properly, etc.static com.codahale.metrics.Countercounter(ActivityDef activityDef, java.lang.String name)Create a counter associated with an activity.static <T> com.codahale.metrics.Gauge<T>gauge(ActivityDef activityDef, java.lang.String name, com.codahale.metrics.Gauge<T> gauge)static <T> com.codahale.metrics.Gauge<T>gauge(javax.script.ScriptContext scriptContext, java.lang.String name, com.codahale.metrics.Gauge<T> gauge)static com.codahale.metrics.MetricRegistrygetMetricRegistry()static com.codahale.metrics.Histogramhistogram(ActivityDef activityDef, java.lang.String name)Create a histogram associated with an activity.static com.codahale.metrics.Metermeter(ActivityDef activityDef, java.lang.String name)Create a meter associated with an activity.static voidmountSubRegistry(java.lang.String mountPrefix, com.codahale.metrics.MetricRegistry subRegistry)static voidremoveActivityMetrics(ActivityDef activityDef)static voidreportTo(java.io.PrintStream out)static com.codahale.metrics.Timertimer(ActivityDef activityDef, java.lang.String name)Create a timer associated with an activity.
-
-
-
Method Detail
-
timer
public static com.codahale.metrics.Timer timer(ActivityDef activityDef, java.lang.String name)
Create a timer associated with an activity.
This method ensures that if multiple threads attempt to create the same-named metric on a given activity, that only one of them succeeds.
- Parameters:
activityDef- an associated activity defname- a simple, descriptive name for the timer- Returns:
- the timer, perhaps a different one if it has already been registered
-
histogram
public static com.codahale.metrics.Histogram histogram(ActivityDef activityDef, java.lang.String name)
Create a histogram associated with an activity.
This method ensures that if multiple threads attempt to create the same-named metric on a given activity, that only one of them succeeds.
- Parameters:
activityDef- an associated activity defname- a simple, descriptive name for the histogram- Returns:
- the histogram, perhaps a different one if it has already been registered
-
counter
public static com.codahale.metrics.Counter counter(ActivityDef activityDef, java.lang.String name)
Create a counter associated with an activity.
This method ensures that if multiple threads attempt to create the same-named metric on a given activity, that only one of them succeeds.
- Parameters:
activityDef- an associated activity defname- a simple, descriptive name for the counter- Returns:
- the counter, perhaps a different one if it has already been registered
-
meter
public static com.codahale.metrics.Meter meter(ActivityDef activityDef, java.lang.String name)
Create a meter associated with an activity.
This method ensures that if multiple threads attempt to create the same-named metric on a given activity, that only one of them succeeds.
- Parameters:
activityDef- an associated activity defname- a simple, descriptive name for the meter- Returns:
- the meter, perhaps a different one if it has already been registered
-
gauge
public static <T> com.codahale.metrics.Gauge<T> gauge(ActivityDef activityDef, java.lang.String name, com.codahale.metrics.Gauge<T> gauge)
-
gauge
public static <T> com.codahale.metrics.Gauge<T> gauge(javax.script.ScriptContext scriptContext, java.lang.String name, com.codahale.metrics.Gauge<T> gauge)
-
getMetricRegistry
public static com.codahale.metrics.MetricRegistry getMetricRegistry()
-
addHistoLogger
public static void addHistoLogger(java.lang.String sessionName, java.lang.String pattern, java.lang.String filename, java.lang.String interval)Add a histogram interval logger to matching metrics in this JVM instance.- Parameters:
sessionName- The name for the session to be annotated in the histogram logpattern- A regular expression pattern to filter out metric names for loggingfilename- A file to log the histogram data ininterval- How many seconds to wait between writing each interval histogram
-
addStatsLogger
public static void addStatsLogger(java.lang.String sessionName, java.lang.String pattern, java.lang.String filename, java.lang.String interval)Add a histogram stats logger to matching metrics in this JVM instance.- Parameters:
sessionName- The name for the session to be annotated in the histogram logpattern- A regular expression pattern to filter out metric names for loggingfilename- A file to log the histogram data ininterval- How many seconds to wait between writing each interval histogram
-
addClassicHistos
public static void addClassicHistos(java.lang.String sessionName, java.lang.String pattern, java.lang.String prefix, java.lang.String interval)Add a classic histogram in addition to the default implementation in this runtime. This is a way to get a view to both the enhanced histogram implementation as well as the classic implementation in the same scenario.- Parameters:
sessionName- The name of the session to be annotated in the classic histogrampattern- A regular expression pattern to filter out metric names for inclusionprefix- The name prefix to add to the classic histograms so that they fit into the existing metrics namespaceinterval- How frequently to update the histogram
-
closeMetrics
public static void closeMetrics(boolean showChart)
This should be called at the end of a process, so that open intervals can be finished, logs closed properly, etc.
-
reportTo
public static void reportTo(java.io.PrintStream out)
-
mountSubRegistry
public static void mountSubRegistry(java.lang.String mountPrefix, com.codahale.metrics.MetricRegistry subRegistry)
-
removeActivityMetrics
public static void removeActivityMetrics(ActivityDef activityDef)
-
-