Class ActivityMetrics
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic com.codahale.metrics.MetricFilter -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddClassicHistos(String sessionName, String pattern, String prefix, String interval) Add a classic histogram in addition to the default implementation in this runtime.static voidaddHistoLogger(String sessionName, String pattern, String filename, String interval) Add a histogram interval logger to matching metrics in this JVM instance.static voidaddStatsLogger(String sessionName, String pattern, String filename, 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(NBNamedElement named, String name) Create a counter associated with an activity.static <T> com.codahale.metrics.Gauge<T>gauge(NBNamedElement named, String name, com.codahale.metrics.Gauge<T> gauge) static <T> com.codahale.metrics.Gauge<T>gauge(ScriptContext scriptContext, String name, com.codahale.metrics.Gauge<T> gauge) static intstatic com.codahale.metrics.MetricRegistrystatic com.codahale.metrics.Histogramhistogram(NBNamedElement named, String name, int hdrdigits) Create an HDR histogram associated with an activity.static com.codahale.metrics.Histogramstatic com.codahale.metrics.Metermeter(NBNamedElement named, String name) Create a meter associated with an activity.static voidmountSubRegistry(String mountPrefix, com.codahale.metrics.MetricRegistry subRegistry) static voidstatic voidreportTo(PrintStream out) static voidsetHdrDigits(int hdrDigits) static com.codahale.metrics.Timertimer(NBNamedElement named, String name, int hdrdigits) Create a timer associated with an activity.static com.codahale.metrics.Timer
-
Field Details
-
HDRDIGITS_PARAM
- See Also:
-
DEFAULT_HDRDIGITS
public static final int DEFAULT_HDRDIGITS- See Also:
-
METRIC_FILTER
public static com.codahale.metrics.MetricFilter METRIC_FILTER
-
-
Method Details
-
getHdrDigits
public static int getHdrDigits() -
setHdrDigits
public static void setHdrDigits(int hdrDigits) -
timer
Create a timer associated with an activity.
If the provide ActivityDef contains a parameter "hdr_digits", then it will be used to set the number of significant digits on the histogram's precision.
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:
named- an associated activity defname- a simple, descriptive name for the timer- Returns:
- the timer, perhaps a different one if it has already been registered
-
timer
-
histogram
public static com.codahale.metrics.Histogram histogram(NBNamedElement named, String name, int hdrdigits) Create an HDR histogram associated with an activity.
If the provide ActivityDef contains a parameter "hdr_digits", then it will be used to set the number of significant digits on the histogram's precision.
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:
named- an associated activity defname- a simple, descriptive name for the histogram- Returns:
- the histogram, perhaps a different one if it has already been registered
-
histogram
-
counter
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:
named- 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
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:
named- 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(NBNamedElement named, String name, com.codahale.metrics.Gauge<T> gauge) -
gauge
public static <T> com.codahale.metrics.Gauge<T> gauge(ScriptContext scriptContext, String name, com.codahale.metrics.Gauge<T> gauge) -
getMetricRegistry
public static com.codahale.metrics.MetricRegistry getMetricRegistry() -
addHistoLogger
public static void addHistoLogger(String sessionName, String pattern, String filename, 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(String sessionName, String pattern, String filename, 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(String sessionName, String pattern, String prefix, 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.- Parameters:
showChart- whether to chart metrics on console
-
reportTo
-
mountSubRegistry
public static void mountSubRegistry(String mountPrefix, com.codahale.metrics.MetricRegistry subRegistry) -
removeActivityMetrics
-