com.yammer.metrics.core
Class Meter

java.lang.Object
  extended by com.yammer.metrics.core.Meter
All Implemented Interfaces:
Metered, Metric, Stoppable

public class Meter
extends Object
implements Metered, Stoppable

A meter metric which measures mean throughput and one-, five-, and fifteen-minute exponentially-weighted moving average throughputs.

See Also:
EMA

Method Summary
 long count()
          Returns the number of events which have been marked.
 String eventType()
          Returns the type of events the meter is measuring.
 double fifteenMinuteRate()
          Returns the fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.
 double fiveMinuteRate()
          Returns the five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.
 void mark()
          Mark the occurrence of an event.
 void mark(long n)
          Mark the occurrence of a given number of events.
 double meanRate()
          Returns the mean rate at which events have occurred since the meter was created.
 double oneMinuteRate()
          Returns the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.
<T> void
processWith(MetricProcessor<T> processor, MetricName name, T context)
          Allow the given MetricProcessor to process this as a metric.
 TimeUnit rateUnit()
          Returns the meter's rate unit.
 void stop()
          Stop the instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rateUnit

public TimeUnit rateUnit()
Description copied from interface: Metered
Returns the meter's rate unit.

Specified by:
rateUnit in interface Metered
Returns:
the meter's rate unit

eventType

public String eventType()
Description copied from interface: Metered
Returns the type of events the meter is measuring.

Specified by:
eventType in interface Metered
Returns:
the meter's event type

mark

public void mark()
Mark the occurrence of an event.


mark

public void mark(long n)
Mark the occurrence of a given number of events.

Parameters:
n - the number of events

count

public long count()
Description copied from interface: Metered
Returns the number of events which have been marked.

Specified by:
count in interface Metered
Returns:
the number of events which have been marked

fifteenMinuteRate

public double fifteenMinuteRate()
Description copied from interface: Metered
Returns the fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

This rate has the same exponential decay factor as the fifteen-minute load average in the top Unix command.

Specified by:
fifteenMinuteRate in interface Metered
Returns:
the fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created

fiveMinuteRate

public double fiveMinuteRate()
Description copied from interface: Metered
Returns the five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

This rate has the same exponential decay factor as the five-minute load average in the top Unix command.

Specified by:
fiveMinuteRate in interface Metered
Returns:
the five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created

meanRate

public double meanRate()
Description copied from interface: Metered
Returns the mean rate at which events have occurred since the meter was created.

Specified by:
meanRate in interface Metered
Returns:
the mean rate at which events have occurred since the meter was created

oneMinuteRate

public double oneMinuteRate()
Description copied from interface: Metered
Returns the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

This rate has the same exponential decay factor as the one-minute load average in the top Unix command.

Specified by:
oneMinuteRate in interface Metered
Returns:
the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created

stop

public void stop()
Description copied from interface: Stoppable
Stop the instance.

Specified by:
stop in interface Stoppable

processWith

public <T> void processWith(MetricProcessor<T> processor,
                            MetricName name,
                            T 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:
T - the type of the context object
Parameters:
processor - a MetricProcessor
name - the name of the current metric
context - a given context which should be passed on to processor
Throws:
Exception - if something goes wrong


Copyright © 2012. All Rights Reserved.