com.yammer.metrics.core
Class Gauge<T>
java.lang.Object
com.yammer.metrics.core.Gauge<T>
- Type Parameters:
T
- the type of the metric's value
- All Implemented Interfaces:
- Metric
- Direct Known Subclasses:
- JmxGauge, RatioGauge, ToggleGauge
public abstract class Gauge<T>
- extends Object
- implements Metric
A gauge metric is an instantaneous reading of a particular value. To instrument a queue's depth,
for example:
final Queue<String> queue = new ConcurrentLinkedQueue<String>();
final Gauge<Integer> queueDepth = new Gauge<Integer>() {
public Integer value() {
return queue.size();
}
};
Constructor Summary |
Gauge()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Gauge
public Gauge()
value
public abstract T value()
- Returns the metric's current value.
- Returns:
- the metric's current value
processWith
public <U> void processWith(MetricProcessor<U> processor,
MetricName name,
U context)
throws Exception
- Description copied from interface:
Metric
- Allow the given
MetricProcessor
to process this
as a metric.
- Specified by:
processWith
in interface Metric
- Type Parameters:
U
- the type of the context object- Parameters:
processor
- a MetricProcessor
name
- the name of the current metriccontext
- a given context which should be passed on to processor
- Throws:
Exception
- if something goes wrong
Copyright © 2012. All Rights Reserved.