All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yammer.metrics.core.Gauge Maven / Gradle / Ivy

There is a newer version: 3.0.0-BETA1
Show newest version
package com.yammer.metrics.core;


/**
 * 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();
 *     }
 * };
 * 
* * @param the type of the metric's value */ public abstract class Gauge implements Metric { /** * Returns the metric's current value. * * @return the metric's current value */ public abstract T value(); @Override public void processWith(MetricProcessor processor, MetricName name, U context) throws Exception { processor.processGauge(name, this, context); } }