Class ActivityMetrics

java.lang.Object
io.nosqlbench.engine.api.metrics.ActivityMetrics

public class ActivityMetrics
extends java.lang.Object
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int DEFAULT_HDRDIGITS  
    static java.lang.String HDRDIGITS_PARAM  
    static com.codahale.metrics.MetricFilter METRIC_FILTER  
  • Method Summary

    Modifier and Type Method Description
    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.
    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.
    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.
    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.
    static com.codahale.metrics.Counter counter​(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 int getHdrDigits()  
    static com.codahale.metrics.MetricRegistry getMetricRegistry()  
    static com.codahale.metrics.Histogram histogram​(ActivityDef activityDef, java.lang.String name)
    Create an HDR histogram associated with an activity.
    static com.codahale.metrics.Meter meter​(ActivityDef activityDef, java.lang.String name)
    Create a meter associated with an activity.
    static void mountSubRegistry​(java.lang.String mountPrefix, com.codahale.metrics.MetricRegistry subRegistry)  
    static void removeActivityMetrics​(ActivityDef activityDef)  
    static void reportTo​(java.io.PrintStream out)  
    static void setHdrDigits​(int hdrDigits)  
    static com.codahale.metrics.Timer timer​(ActivityDef activityDef, java.lang.String name)
    Create a timer associated with an activity.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getHdrDigits

      public static int getHdrDigits()
    • setHdrDigits

      public static void setHdrDigits​(int hdrDigits)
    • timer

      public static com.codahale.metrics.Timer timer​(ActivityDef activityDef, java.lang.String name)

      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:
      activityDef - an associated activity def
      name - 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 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:
      activityDef - an associated activity def
      name - 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 def
      name - 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 def
      name - 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 log
      pattern - A regular expression pattern to filter out metric names for logging
      filename - A file to log the histogram data in
      interval - 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 log
      pattern - A regular expression pattern to filter out metric names for logging
      filename - A file to log the histogram data in
      interval - 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 histogram
      pattern - A regular expression pattern to filter out metric names for inclusion
      prefix - The name prefix to add to the classic histograms so that they fit into the existing metrics namespace
      interval - 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

      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)