public class Metrics extends Object
Modifier and Type | Method and Description |
---|---|
static MetricsRegistry |
defaultRegistry()
Returns the (static) default registry.
|
static Counter |
newCounter(Class<?> klass,
String name)
Creates a new
Counter and registers it under the given class
and name. |
static Counter |
newCounter(Class<?> klass,
String name,
String scope)
Creates a new
Counter and registers it under the given class
and name. |
static Counter |
newCounter(MetricName metricName)
Creates a new
Counter and registers it under the given metric
name. |
static <T> Gauge<T> |
newGauge(Class<?> klass,
String name,
Gauge<T> metric)
Given a new
Gauge , registers it under the given class and
name. |
static <T> Gauge<T> |
newGauge(Class<?> klass,
String name,
String scope,
Gauge<T> metric)
Given a new
Gauge , registers it under the given class and
name. |
static <T> Gauge<T> |
newGauge(MetricName metricName,
Gauge<T> metric)
Given a new
Gauge , registers it under the given metric name. |
static Histogram |
newHistogram(Class<?> klass,
String name)
Creates a new non-biased
Histogram and registers it under the
given class and name. |
static Histogram |
newHistogram(Class<?> klass,
String name,
boolean biased)
Creates a new
Histogram and registers it under the given
class and name. |
static Histogram |
newHistogram(Class<?> klass,
String name,
String scope)
Creates a new non-biased
Histogram and registers it under the
given class, name, and scope. |
static Histogram |
newHistogram(Class<?> klass,
String name,
String scope,
boolean biased)
Creates a new
Histogram and registers it under the given
class, name, and scope. |
static Histogram |
newHistogram(MetricName metricName)
Creates a new non-biased
Histogram and registers it under the
given metric name. |
static Histogram |
newHistogram(MetricName metricName,
boolean biased)
Creates a new
Histogram and registers it under the given
metric name. |
static Meter |
newMeter(Class<?> klass,
String name,
String scope,
String eventType,
TimeUnit unit)
Creates a new
Meter and registers it under the given class,
name, and scope. |
static Meter |
newMeter(Class<?> klass,
String name,
String eventType,
TimeUnit unit)
Creates a new
Meter and registers it under the given class
and name. |
static Meter |
newMeter(MetricName metricName,
String eventType,
TimeUnit unit)
Creates a new
Meter and registers it under the given metric
name. |
static Timer |
newTimer(Class<?> klass,
String name)
Creates a new
Timer and registers it under the given class
and name, measuring elapsed time in milliseconds and invocations per second. |
static Timer |
newTimer(Class<?> klass,
String name,
String scope)
Creates a new
Timer and registers it under the given class,
name, and scope, measuring elapsed time in milliseconds and invocations per second. |
static Timer |
newTimer(Class<?> klass,
String name,
String scope,
TimeUnit durationUnit,
TimeUnit rateUnit)
Creates a new
Timer and registers it under the given class,
name, and scope. |
static Timer |
newTimer(Class<?> klass,
String name,
TimeUnit durationUnit,
TimeUnit rateUnit)
Creates a new
Timer and registers it under the given class
and name. |
static Timer |
newTimer(MetricName metricName,
TimeUnit durationUnit,
TimeUnit rateUnit)
Creates a new
Timer and registers it under the given metric
name. |
static void |
shutdown()
Shuts down all thread pools for the default registry.
|
public static <T> Gauge<T> newGauge(Class<?> klass, String name, Gauge<T> metric)
Gauge
, registers it under the given class and
name.T
- the type of the value returned by the metricklass
- the class which owns the metricname
- the name of the metricmetric
- the metricmetric
public static <T> Gauge<T> newGauge(Class<?> klass, String name, String scope, Gauge<T> metric)
Gauge
, registers it under the given class and
name.T
- the type of the value returned by the metricklass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metricmetric
- the metricmetric
public static <T> Gauge<T> newGauge(MetricName metricName, Gauge<T> metric)
Gauge
, registers it under the given metric name.T
- the type of the value returned by the metricmetricName
- the name of the metricmetric
- the metricmetric
public static Counter newCounter(Class<?> klass, String name)
Counter
and registers it under the given class
and name.klass
- the class which owns the metricname
- the name of the metricCounter
public static Counter newCounter(Class<?> klass, String name, String scope)
Counter
and registers it under the given class
and name.klass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metricCounter
public static Counter newCounter(MetricName metricName)
Counter
and registers it under the given metric
name.metricName
- the name of the metricCounter
public static Histogram newHistogram(Class<?> klass, String name, boolean biased)
Histogram
and registers it under the given
class and name.klass
- the class which owns the metricname
- the name of the metricbiased
- whether or not the histogram should be biasedHistogram
public static Histogram newHistogram(Class<?> klass, String name, String scope, boolean biased)
Histogram
and registers it under the given
class, name, and scope.klass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metricbiased
- whether or not the histogram should be biasedHistogram
public static Histogram newHistogram(MetricName metricName, boolean biased)
Histogram
and registers it under the given
metric name.metricName
- the name of the metricbiased
- whether or not the histogram should be biasedHistogram
public static Histogram newHistogram(Class<?> klass, String name)
Histogram
and registers it under the
given class and name.klass
- the class which owns the metricname
- the name of the metricHistogram
public static Histogram newHistogram(Class<?> klass, String name, String scope)
Histogram
and registers it under the
given class, name, and scope.klass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metricHistogram
public static Histogram newHistogram(MetricName metricName)
Histogram
and registers it under the
given metric name.metricName
- the name of the metricHistogram
public static Meter newMeter(Class<?> klass, String name, String eventType, TimeUnit unit)
Meter
and registers it under the given class
and name.klass
- the class which owns the metricname
- the name of the metriceventType
- the plural name of the type of events the meter is measuring (e.g., "requests"
)unit
- the rate unit of the new meterMeter
public static Meter newMeter(Class<?> klass, String name, String scope, String eventType, TimeUnit unit)
Meter
and registers it under the given class,
name, and scope.klass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metriceventType
- the plural name of the type of events the meter is measuring (e.g., "requests"
)unit
- the rate unit of the new meterMeter
public static Meter newMeter(MetricName metricName, String eventType, TimeUnit unit)
Meter
and registers it under the given metric
name.metricName
- the name of the metriceventType
- the plural name of the type of events the meter is measuring (e.g., "requests"
)unit
- the rate unit of the new meterMeter
public static Timer newTimer(Class<?> klass, String name, TimeUnit durationUnit, TimeUnit rateUnit)
Timer
and registers it under the given class
and name.klass
- the class which owns the metricname
- the name of the metricdurationUnit
- the duration scale unit of the new timerrateUnit
- the rate scale unit of the new timerTimer
public static Timer newTimer(Class<?> klass, String name)
Timer
and registers it under the given class
and name, measuring elapsed time in milliseconds and invocations per second.klass
- the class which owns the metricname
- the name of the metricTimer
public static Timer newTimer(Class<?> klass, String name, String scope, TimeUnit durationUnit, TimeUnit rateUnit)
Timer
and registers it under the given class,
name, and scope.klass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metricdurationUnit
- the duration scale unit of the new timerrateUnit
- the rate scale unit of the new timerTimer
public static Timer newTimer(Class<?> klass, String name, String scope)
Timer
and registers it under the given class,
name, and scope, measuring elapsed time in milliseconds and invocations per second.klass
- the class which owns the metricname
- the name of the metricscope
- the scope of the metricTimer
public static Timer newTimer(MetricName metricName, TimeUnit durationUnit, TimeUnit rateUnit)
Timer
and registers it under the given metric
name.metricName
- the name of the metricdurationUnit
- the duration scale unit of the new timerrateUnit
- the rate scale unit of the new timerTimer
public static MetricsRegistry defaultRegistry()
public static void shutdown()