|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.metrics.codahale_metrics.metrics.core.MetricsRegistry
public class MetricsRegistry
A registry of metric instances.
Constructor Summary | |
---|---|
MetricsRegistry()
Creates a new MetricsRegistry . |
|
MetricsRegistry(Clock clock)
Creates a new MetricsRegistry with the given Clock instance. |
Method Summary | ||
---|---|---|
void |
addListener(MetricsRegistryListener listener)
Adds a MetricsRegistryListener to a collection of listeners that will be notified on
metric creation. |
|
java.util.Map<MetricName,Metric> |
allMetrics()
Returns an unmodifiable map of all metrics and their names. |
|
protected MetricName |
createName(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope)
Override to customize how MetricName s are created. |
|
protected
|
getOrAdd(MetricName name,
T metric)
Gets any existing metric with the given name or, if none exists, adds the given metric. |
|
java.util.SortedMap<java.lang.String,java.util.SortedMap<MetricName,Metric>> |
groupedMetrics()
Returns a grouped and sorted map of all registered metrics. |
|
java.util.SortedMap<java.lang.String,java.util.SortedMap<MetricName,Metric>> |
groupedMetrics(MetricPredicate predicate)
Returns a grouped and sorted map of all registered metrics which match then given MetricPredicate . |
|
Counter |
newCounter(java.lang.Class<?> klass,
java.lang.String name)
Creates a new Counter and registers it under the given class and name. |
|
Counter |
newCounter(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope)
Creates a new Counter and registers it under the given class and name. |
|
Counter |
newCounter(MetricName metricName)
Creates a new Counter and registers it under the given metric name. |
|
|
newGauge(java.lang.Class<?> klass,
java.lang.String name,
Gauge<T> metric)
Given a new Gauge , registers it under the given class and name. |
|
|
newGauge(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope,
Gauge<T> metric)
Given a new Gauge , registers it under the given class and name. |
|
|
newGauge(MetricName metricName,
Gauge<T> metric)
Given a new Gauge , registers it under the given metric name. |
|
Histogram |
newHistogram(java.lang.Class<?> klass,
java.lang.String name)
Creates a new non-biased Histogram and registers it under the given class and name. |
|
Histogram |
newHistogram(java.lang.Class<?> klass,
java.lang.String name,
boolean biased)
Creates a new Histogram and registers it under the given class and name. |
|
Histogram |
newHistogram(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope)
Creates a new non-biased Histogram and registers it under the given class, name, and
scope. |
|
Histogram |
newHistogram(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope,
boolean biased)
Creates a new Histogram and registers it under the given class, name, and scope. |
|
Histogram |
newHistogram(MetricName metricName,
boolean biased)
Creates a new Histogram and registers it under the given metric name. |
|
Meter |
newMeter(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope,
java.lang.String eventType,
java.util.concurrent.TimeUnit unit)
Creates a new Meter and registers it under the given class, name, and scope. |
|
Meter |
newMeter(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String eventType,
java.util.concurrent.TimeUnit unit)
Creates a new Meter and registers it under the given class and name. |
|
Meter |
newMeter(MetricName metricName,
java.lang.String eventType,
java.util.concurrent.TimeUnit unit)
Creates a new Meter and registers it under the given metric name. |
|
protected java.util.concurrent.ConcurrentMap<MetricName,Metric> |
newMetricsMap()
Returns a new ConcurrentMap implementation. |
|
java.util.concurrent.ScheduledExecutorService |
newScheduledThreadPool(int poolSize,
java.lang.String name)
Creates a new scheduled thread pool of a given size with the given name, or returns an existing thread pool if one was already created with the same name. |
|
Timer |
newTimer(java.lang.Class<?> klass,
java.lang.String name)
Creates a new Timer and registers it under the given class and name, measuring
elapsed time in milliseconds and invocations per second. |
|
Timer |
newTimer(java.lang.Class<?> klass,
java.lang.String name,
java.lang.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. |
|
Timer |
newTimer(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope,
java.util.concurrent.TimeUnit durationUnit,
java.util.concurrent.TimeUnit rateUnit)
Creates a new Timer and registers it under the given class, name, and scope. |
|
Timer |
newTimer(java.lang.Class<?> klass,
java.lang.String name,
java.util.concurrent.TimeUnit durationUnit,
java.util.concurrent.TimeUnit rateUnit)
Creates a new Timer and registers it under the given class and name. |
|
Timer |
newTimer(MetricName metricName,
java.util.concurrent.TimeUnit durationUnit,
java.util.concurrent.TimeUnit rateUnit)
Creates a new Timer and registers it under the given metric name. |
|
void |
removeListener(MetricsRegistryListener listener)
Removes a MetricsRegistryListener from this registry's collection of listeners. |
|
void |
removeMetric(java.lang.Class<?> klass,
java.lang.String name)
Removes the metric for the given class with the given name. |
|
void |
removeMetric(java.lang.Class<?> klass,
java.lang.String name,
java.lang.String scope)
Removes the metric for the given class with the given name and scope. |
|
void |
removeMetric(MetricName name)
Removes the metric with the given name. |
|
void |
shutdown()
Shut down this registry's thread pools. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MetricsRegistry()
MetricsRegistry
.
public MetricsRegistry(Clock clock)
MetricsRegistry
with the given Clock
instance.
clock
- a Clock
instanceMethod Detail |
---|
public <T> Gauge<T> newGauge(java.lang.Class<?> klass, java.lang.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 metric
metric
public <T> Gauge<T> newGauge(java.lang.Class<?> klass, java.lang.String name, java.lang.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 metric
metric
public <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 metric
metric
public Counter newCounter(java.lang.Class<?> klass, java.lang.String name)
Counter
and registers it under the given class and name.
klass
- the class which owns the metricname
- the name of the metric
Counter
public Counter newCounter(java.lang.Class<?> klass, java.lang.String name, java.lang.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 metric
Counter
public Counter newCounter(MetricName metricName)
Counter
and registers it under the given metric name.
metricName
- the name of the metric
Counter
public Histogram newHistogram(java.lang.Class<?> klass, java.lang.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 biased
Histogram
public Histogram newHistogram(java.lang.Class<?> klass, java.lang.String name, java.lang.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 biased
Histogram
public Histogram newHistogram(java.lang.Class<?> klass, java.lang.String name)
Histogram
and registers it under the given class and name.
klass
- the class which owns the metricname
- the name of the metric
Histogram
public Histogram newHistogram(java.lang.Class<?> klass, java.lang.String name, java.lang.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 metric
Histogram
public 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 biased
Histogram
public Meter newMeter(java.lang.Class<?> klass, java.lang.String name, java.lang.String eventType, java.util.concurrent.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 meter
Meter
public Meter newMeter(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope, java.lang.String eventType, java.util.concurrent.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 meter
Meter
public Meter newMeter(MetricName metricName, java.lang.String eventType, java.util.concurrent.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 meter
Meter
public Timer newTimer(java.lang.Class<?> klass, java.lang.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 metric
Timer
public Timer newTimer(java.lang.Class<?> klass, java.lang.String name, java.util.concurrent.TimeUnit durationUnit, java.util.concurrent.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 timer
Timer
public Timer newTimer(java.lang.Class<?> klass, java.lang.String name, java.lang.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 metric
Timer
public Timer newTimer(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope, java.util.concurrent.TimeUnit durationUnit, java.util.concurrent.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 timer
Timer
public Timer newTimer(MetricName metricName, java.util.concurrent.TimeUnit durationUnit, java.util.concurrent.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 timer
Timer
public java.util.Map<MetricName,Metric> allMetrics()
public java.util.SortedMap<java.lang.String,java.util.SortedMap<MetricName,Metric>> groupedMetrics()
public java.util.SortedMap<java.lang.String,java.util.SortedMap<MetricName,Metric>> groupedMetrics(MetricPredicate predicate)
MetricPredicate
.
predicate
- a predicate which metrics have to match to be in the results
predicate
, sorted by namepublic void shutdown()
public java.util.concurrent.ScheduledExecutorService newScheduledThreadPool(int poolSize, java.lang.String name)
poolSize
- the number of threads to createname
- the name of the pool
ScheduledExecutorService
public void removeMetric(java.lang.Class<?> klass, java.lang.String name)
klass
- the klass the metric is associated withname
- the name of the metricpublic void removeMetric(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope)
klass
- the klass the metric is associated withname
- the name of the metricscope
- the scope of the metricpublic void removeMetric(MetricName name)
name
- the name of the metricpublic void addListener(MetricsRegistryListener listener)
MetricsRegistryListener
to a collection of listeners that will be notified on
metric creation. Listeners will be notified in the order in which they are added.
N.B.: The listener will be notified of all existing metrics when it first registers.
listener
- the listener that will be notifiedpublic void removeListener(MetricsRegistryListener listener)
MetricsRegistryListener
from this registry's collection of listeners.
listener
- the listener that will be removedprotected MetricName createName(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope)
MetricName
s are created.
klass
- the class which owns the metricname
- the name of the metricscope
- the metric's scope
protected java.util.concurrent.ConcurrentMap<MetricName,Metric> newMetricsMap()
ConcurrentMap
implementation. Subclass this to do weird things with
your own MetricsRegistry
implementation.
ConcurrentMap
protected final <T extends Metric> T getOrAdd(MetricName name, T metric)
T
- the type of the metricname
- the metric's namemetric
- the new metric
metric
|
© 2006-2014 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |