com.yammer.metrics.core
Class MeterMetric

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

public class MeterMetric
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

Constructor Summary
MeterMetric(ScheduledExecutorService tickThread, String eventType, TimeUnit rateUnit, Clock clock)
           
 
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.
static MeterMetric newMeter(ScheduledExecutorService tickThread, String eventType, TimeUnit rateUnit)
          Creates a new MeterMetric.
static MeterMetric newMeter(String eventType, TimeUnit rateUnit)
          Deprecated. use the other newMeter method or create a new meter via the MetricsRegistry or Metrics
 double oneMinuteRate()
          Returns the one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.
<T> void
processWith(MetricsProcessor<T> processor, MetricName name, T context)
           
 TimeUnit rateUnit()
          Returns the meter's rate unit.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeterMetric

public MeterMetric(ScheduledExecutorService tickThread,
                   String eventType,
                   TimeUnit rateUnit,
                   Clock clock)
Method Detail

newMeter

public static MeterMetric newMeter(String eventType,
                                   TimeUnit rateUnit)
Deprecated. use the other newMeter method or create a new meter via the MetricsRegistry or Metrics

Creates a new MeterMetric.

Parameters:
eventType - the plural name of the event the meter is measuring (e.g., "requests")
rateUnit - the rate unit of the new meter
Returns:
a new MeterMetric

newMeter

public static MeterMetric newMeter(ScheduledExecutorService tickThread,
                                   String eventType,
                                   TimeUnit rateUnit)
Creates a new MeterMetric.

Parameters:
tickThread - background thread for updating the rates
eventType - the plural name of the event the meter is measuring (e.g., "requests")
rateUnit - the rate unit of the new meter
Returns:
a new MeterMetric

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()
Specified by:
stop in interface Stoppable

processWith

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


Copyright © 2011. All Rights Reserved.