com.clearspring.metriccatcher
Class MetricCatcher

java.lang.Object
  extended by java.lang.Thread
      extended by com.clearspring.metriccatcher.MetricCatcher
All Implemented Interfaces:
Runnable

public class MetricCatcher
extends Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MetricCatcher(DatagramSocket socket, Map<String,com.yammer.metrics.core.Metric> metricCache)
           
 
Method Summary
protected  com.yammer.metrics.core.Metric createMetric(JSONMetric jsonMetric)
          Create a Metric object from a JSONMetric
 void run()
          Grab metric messages off the listening socket, creating and updating them as needed.
 void shutdown()
          Shutdown this MetricCatcher
protected  void updateMetric(com.yammer.metrics.core.Metric metric, double value)
          Update various metric types.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetricCatcher

public MetricCatcher(DatagramSocket socket,
                     Map<String,com.yammer.metrics.core.Metric> metricCache)
              throws IOException
Throws:
IOException
Method Detail

run

public void run()
Grab metric messages off the listening socket, creating and updating them as needed.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

createMetric

protected com.yammer.metrics.core.Metric createMetric(JSONMetric jsonMetric)
Create a Metric object from a JSONMetric

Parameters:
jsonMetric - A JSONMetric to make a Metric from
Returns:
A Metric equivalent to the given JSONMetric

updateMetric

protected void updateMetric(com.yammer.metrics.core.Metric metric,
                            double value)
Update various metric types. Gauge: Counter: Increment or decrement based upon sign of value Clear counter if given 0 Meter: mark() the meter with the given value Histogram: update() the histogram with the given value Timer:

Parameters:
metric - The metric to update
value - The value to supply when updating the metric

shutdown

public void shutdown()
Shutdown this MetricCatcher



Copyright © 2012. All Rights Reserved.