Class ActivityMetrics

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

public class ActivityMetrics extends Object
  • Field Details

    • HDRDIGITS_PARAM

      public static final String 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

      public static com.codahale.metrics.Timer timer(NBNamedElement named, String name, int hdrdigits)

      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 def
      name - a simple, descriptive name for the timer
      Returns:
      the timer, perhaps a different one if it has already been registered
    • timer

      public static com.codahale.metrics.Timer timer(String fullMetricName)
    • 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 def
      name - a simple, descriptive name for the histogram
      Returns:
      the histogram, perhaps a different one if it has already been registered
    • histogram

      public static com.codahale.metrics.Histogram histogram(String fullname)
    • counter

      public static com.codahale.metrics.Counter counter(NBNamedElement named, 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:
      named - 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(NBNamedElement named, 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:
      named - 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(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 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(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 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(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 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(PrintStream out)
    • mountSubRegistry

      public static void mountSubRegistry(String mountPrefix, com.codahale.metrics.MetricRegistry subRegistry)
    • removeActivityMetrics

      public static void removeActivityMetrics(NBNamedElement named)