org.apache.hadoop.metrics.ganglia
Class GangliaContext
java.lang.Object
org.apache.hadoop.metrics.spi.AbstractMetricsContext
org.apache.hadoop.metrics.ganglia.GangliaContext
- All Implemented Interfaces:
- MetricsContext
- Direct Known Subclasses:
- GangliaContext31
public class GangliaContext
- extends AbstractMetricsContext
Context for sending metrics to Ganglia.
Constructor Summary |
GangliaContext()
Creates a new instance of GangliaContext |
Methods inherited from class org.apache.hadoop.metrics.spi.AbstractMetricsContext |
close, createRecord, flush, getAllRecords, getAttribute, getAttributeTable, getContextFactory, getContextName, getPeriod, isMonitoring, newRecord, parseAndSetPeriod, registerUpdater, remove, setPeriod, startMonitoring, stopMonitoring, unregisterUpdater, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buffer
protected byte[] buffer
offset
protected int offset
metricsServers
protected List<? extends SocketAddress> metricsServers
datagramSocket
protected DatagramSocket datagramSocket
GangliaContext
public GangliaContext()
- Creates a new instance of GangliaContext
init
public void init(String contextName,
ContextFactory factory)
- Description copied from class:
AbstractMetricsContext
- Initializes the context.
- Specified by:
init
in interface MetricsContext
- Overrides:
init
in class AbstractMetricsContext
- Parameters:
contextName
- The given name for this contextfactory
- The creator of this context
emitRecord
public void emitRecord(String contextName,
String recordName,
OutputRecord outRec)
throws IOException
- Description copied from class:
AbstractMetricsContext
- Sends a record to the metrics system.
- Specified by:
emitRecord
in class AbstractMetricsContext
- Throws:
IOException
emitMetric
protected void emitMetric(String name,
String type,
String value)
throws IOException
- Throws:
IOException
getUnits
protected String getUnits(String metricName)
getSlope
protected int getSlope(String metricName)
getTmax
protected int getTmax(String metricName)
getDmax
protected int getDmax(String metricName)
xdr_string
protected void xdr_string(String s)
- Puts a string into the buffer by first writing the size of the string
as an int, followed by the bytes of the string, padded if necessary to
a multiple of 4.
xdr_int
protected void xdr_int(int i)
- Puts an integer into the buffer as 4 bytes, big-endian.
Copyright © 2009 The Apache Software Foundation