|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.yammer.metrics.core.MetricsRegistry
public class MetricsRegistry
A registry of metric instances.
| Constructor Summary | |
|---|---|
MetricsRegistry()
|
|
| Method Summary | ||
|---|---|---|
void |
addListener(MetricsRegistryListener listener)
Adds a MetricsRegistryListener to a collection of listeners that will be notified on
metric creation. |
|
Map<MetricName,Metric> |
allMetrics()
Returns an unmodifiable map of all metrics and their names. |
|
MetricName |
createName(Class<?> klass,
String name,
String scope)
Override to customize how MetricNames are created. |
|
protected
|
getOrAdd(MetricName name,
T metric)
|
|
CounterMetric |
newCounter(Class<?> klass,
String name)
Creates a new CounterMetric and registers it under the given
class and name. |
|
CounterMetric |
newCounter(Class<?> klass,
String name,
String scope)
Creates a new CounterMetric and registers it under the given
class and name. |
|
CounterMetric |
newCounter(MetricName metricName)
Creates a new CounterMetric and registers it under the given
metric name. |
|
|
newGauge(Class<?> klass,
String name,
GaugeMetric<T> metric)
Given a new GaugeMetric, registers it under the given class
and name. |
|
|
newGauge(Class<?> klass,
String name,
String scope,
GaugeMetric<T> metric)
Given a new GaugeMetric, registers it under the given class
and name. |
|
|
newGauge(MetricName metricName,
GaugeMetric<T> metric)
Given a new GaugeMetric, registers it under the given metric
name. |
|
HistogramMetric |
newHistogram(Class<?> klass,
String name)
Creates a new non-biased HistogramMetric and registers it under the given class and
name. |
|
HistogramMetric |
newHistogram(Class<?> klass,
String name,
boolean biased)
Creates a new HistogramMetric and registers it under the given class and name. |
|
HistogramMetric |
newHistogram(Class<?> klass,
String name,
String scope)
Creates a new non-biased HistogramMetric and registers it under the given class,
name, and scope. |
|
HistogramMetric |
newHistogram(Class<?> klass,
String name,
String scope,
boolean biased)
Creates a new HistogramMetric and registers it under the given class, name, and
scope. |
|
HistogramMetric |
newHistogram(MetricName metricName,
boolean biased)
Creates a new HistogramMetric and registers it under the given metric name. |
|
JmxGauge |
newJmxGauge(Class<?> klass,
String name,
String objectName,
String attribute)
Given a JMX MBean's object name and an attribute name, registers a gauge for that attribute under the given class and name. |
|
JmxGauge |
newJmxGauge(Class<?> klass,
String name,
String scope,
String objectName,
String attribute)
Given a JMX MBean's object name and an attribute name, registers a gauge for that attribute under the given class, name, and scope. |
|
JmxGauge |
newJmxGauge(MetricName metricName,
String objectName,
String attribute)
Given a JMX MBean's object name and an attribute name, registers a gauge for that attribute under the given metric name. |
|
MeterMetric |
newMeter(Class<?> klass,
String name,
String scope,
String eventType,
TimeUnit unit)
Creates a new MeterMetric and registers it under the given class, name, and scope. |
|
MeterMetric |
newMeter(Class<?> klass,
String name,
String eventType,
TimeUnit unit)
Creates a new MeterMetric and registers it under the given class and name. |
|
MeterMetric |
newMeter(MetricName metricName,
String eventType,
TimeUnit unit)
Creates a new MeterMetric and registers it under the given metric name. |
|
ScheduledExecutorService |
newMeterTickThreadPool()
|
|
protected ConcurrentMap<MetricName,Metric> |
newMetricsMap()
Returns a new ConcurrentMap implementation. |
|
TimerMetric |
newTimer(Class<?> klass,
String name)
Creates a new TimerMetric and registers it under the given class and name, measuring
elapsed time in milliseconds and invocations per second. |
|
TimerMetric |
newTimer(Class<?> klass,
String name,
String scope)
Creates a new TimerMetric and registers it under the given class, name, and scope,
measuring elapsed time in milliseconds and invocations per second. |
|
TimerMetric |
newTimer(Class<?> klass,
String name,
String scope,
TimeUnit durationUnit,
TimeUnit rateUnit)
Creates a new TimerMetric and registers it under the given class, name, and scope. |
|
TimerMetric |
newTimer(Class<?> klass,
String name,
TimeUnit durationUnit,
TimeUnit rateUnit)
Creates a new TimerMetric and registers it under the given class and name. |
|
TimerMetric |
newTimer(MetricName metricName,
TimeUnit durationUnit,
TimeUnit rateUnit)
Creates a new TimerMetric and registers it under the given metric name. |
|
void |
removeListener(MetricsRegistryListener listener)
Removes a MetricsRegistryListener from this registry's collection of listeners. |
|
void |
removeMetric(Class<?> klass,
String name)
Removes the metric for the given class with the given name. |
|
void |
removeMetric(Class<?> klass,
String name,
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. |
|
ThreadPools |
threadPools()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MetricsRegistry()
| Method Detail |
|---|
public <T> GaugeMetric<T> newGauge(Class<?> klass,
String name,
GaugeMetric<T> metric)
GaugeMetric, 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> GaugeMetric<T> newGauge(Class<?> klass,
String name,
String scope,
GaugeMetric<T> metric)
GaugeMetric, 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> GaugeMetric<T> newGauge(MetricName metricName,
GaugeMetric<T> metric)
GaugeMetric, 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 JmxGauge newJmxGauge(Class<?> klass,
String name,
String objectName,
String attribute)
throws MalformedObjectNameException
klass - the class which owns the metricname - the name of the metricobjectName - the object name of the MBeanattribute - the name of the bean's attribute
JmxGauge
MalformedObjectNameException - if the object name is malformed
public JmxGauge newJmxGauge(Class<?> klass,
String name,
String scope,
String objectName,
String attribute)
throws MalformedObjectNameException
klass - the class which owns the metricname - the name of the metricscope - the scope of the metricobjectName - the object name of the MBeanattribute - the name of the bean's attribute
JmxGauge
MalformedObjectNameException - if the object name is malformed
public JmxGauge newJmxGauge(MetricName metricName,
String objectName,
String attribute)
throws MalformedObjectNameException
metricName - the name of the metricobjectName - the object name of the MBeanattribute - the name of the bean's attribute
JmxGauge
MalformedObjectNameException - if the object name is malformed
public CounterMetric newCounter(Class<?> klass,
String name)
CounterMetric and registers it under the given
class and name.
klass - the class which owns the metricname - the name of the metric
CounterMetric
public CounterMetric newCounter(Class<?> klass,
String name,
String scope)
CounterMetric 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
CounterMetricpublic CounterMetric newCounter(MetricName metricName)
CounterMetric and registers it under the given
metric name.
metricName - the name of the metric
CounterMetric
public HistogramMetric newHistogram(Class<?> klass,
String name,
boolean biased)
HistogramMetric 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
HistogramMetric
public HistogramMetric newHistogram(Class<?> klass,
String name,
String scope,
boolean biased)
HistogramMetric 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
HistogramMetric
public HistogramMetric newHistogram(Class<?> klass,
String name)
HistogramMetric and registers it under the given class and
name.
klass - the class which owns the metricname - the name of the metric
HistogramMetric
public HistogramMetric newHistogram(Class<?> klass,
String name,
String scope)
HistogramMetric 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
HistogramMetric
public HistogramMetric newHistogram(MetricName metricName,
boolean biased)
HistogramMetric and registers it under the given metric name.
metricName - the name of the metricbiased - whether or not the histogram should be biased
HistogramMetric
public MeterMetric newMeter(Class<?> klass,
String name,
String eventType,
TimeUnit unit)
MeterMetric 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
MeterMetric
public MeterMetric newMeter(Class<?> klass,
String name,
String scope,
String eventType,
TimeUnit unit)
MeterMetric 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
MeterMetric
public MeterMetric newMeter(MetricName metricName,
String eventType,
TimeUnit unit)
MeterMetric 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
MeterMetric
public TimerMetric newTimer(Class<?> klass,
String name)
TimerMetric 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
TimerMetric
public TimerMetric newTimer(Class<?> klass,
String name,
TimeUnit durationUnit,
TimeUnit rateUnit)
TimerMetric 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
TimerMetric
public TimerMetric newTimer(Class<?> klass,
String name,
String scope)
TimerMetric 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
TimerMetric
public TimerMetric newTimer(Class<?> klass,
String name,
String scope,
TimeUnit durationUnit,
TimeUnit rateUnit)
TimerMetric 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
TimerMetric
public TimerMetric newTimer(MetricName metricName,
TimeUnit durationUnit,
TimeUnit rateUnit)
TimerMetric 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
TimerMetric
public MetricName createName(Class<?> klass,
String name,
String scope)
MetricNames are created.
klass - the class which owns the metricname - the name of the metricscope - the metric's scope
public Map<MetricName,Metric> allMetrics()
public ThreadPools threadPools()
public ScheduledExecutorService newMeterTickThreadPool()
public void removeMetric(Class<?> klass,
String name)
klass - the klass the metric is associated withname - the name of the metric
public void removeMetric(Class<?> klass,
String name,
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 metricprotected 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)
public 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 removed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||