com.yammer.metrics.core
Class GaugeMetric<T>

java.lang.Object
  extended by com.yammer.metrics.core.GaugeMetric<T>
Type Parameters:
T - the type of the metric's value
All Implemented Interfaces:
Metric
Direct Known Subclasses:
JmxGauge

public abstract class GaugeMetric<T>
extends Object
implements Metric

A gauge metric is an instantaneous reading of a particular value. To instrument a queue's depth, for example:


 Queue queue = new ConcurrentLinkedQueue();
 GaugeMetric queueDepth = new GaugeMetric() {
     public Integer value() {
         return queue.size();
     }
 };
 


Constructor Summary
GaugeMetric()
           
 
Method Summary
<U> void
processWith(MetricsProcessor<U> processor, MetricName name, U context)
           
abstract  T value()
          Returns the metric's current value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GaugeMetric

public GaugeMetric()
Method Detail

value

public abstract T value()
Returns the metric's current value.

Returns:
the metric's current value

processWith

public <U> void processWith(MetricsProcessor<U> processor,
                            MetricName name,
                            U context)
                 throws Exception
Specified by:
processWith in interface Metric
Throws:
Exception


Copyright © 2011. All Rights Reserved.