Class GangliaContext
- java.lang.Object
-
- com.mapr.org.apache.hadoop.metrics.spi.AbstractMetricsContext
-
- com.mapr.org.apache.hadoop.metrics.ganglia.GangliaContext
-
- All Implemented Interfaces:
MetricsContext
- Direct Known Subclasses:
GangliaContext31
@Public @Evolving public class GangliaContext extends AbstractMetricsContext
Context for sending metrics to Ganglia.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.mapr.org.apache.hadoop.metrics.spi.AbstractMetricsContext
AbstractMetricsContext.MetricMap, AbstractMetricsContext.TagMap
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufferprotected java.net.DatagramSocketdatagramSocketprotected java.util.List<? extends java.net.SocketAddress>metricsServersprotected intoffset-
Fields inherited from interface com.mapr.org.apache.hadoop.metrics.MetricsContext
DEFAULT_PERIOD
-
-
Constructor Summary
Constructors Constructor Description GangliaContext()Creates a new instance of GangliaContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()method to close the datagram socketprotected voidemitMetric(java.lang.String name, java.lang.String type, java.lang.String value)voidemitRecord(java.lang.String contextName, java.lang.String recordName, OutputRecord outRec)Sends a record to the metrics system.protected intgetDmax(java.lang.String metricName)protected intgetSlope(java.lang.String metricName)protected intgetTmax(java.lang.String metricName)protected java.lang.StringgetUnits(java.lang.String metricName)voidinit(java.lang.String contextName, ContextFactory factory)Initializes the context.protected voidxdr_int(int i)Puts an integer into the buffer as 4 bytes, big-endian.protected voidxdr_string(java.lang.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.-
Methods inherited from class com.mapr.org.apache.hadoop.metrics.spi.AbstractMetricsContext
createRecord, flush, getAllRecords, getAttribute, getAttributeTable, getContextFactory, getContextName, getPeriod, isMonitoring, newRecord, parseAndSetPeriod, registerUpdater, remove, setPeriod, startMonitoring, stopMonitoring, unregisterUpdater, update
-
-
-
-
Method Detail
-
init
@Private public void init(java.lang.String contextName, ContextFactory factory)Description copied from class:AbstractMetricsContextInitializes the context.- Specified by:
initin interfaceMetricsContext- Overrides:
initin classAbstractMetricsContext- Parameters:
contextName- The given name for this contextfactory- The creator of this context
-
close
public void close()
method to close the datagram socket- Specified by:
closein interfaceMetricsContext- Overrides:
closein classAbstractMetricsContext
-
emitRecord
@Private public void emitRecord(java.lang.String contextName, java.lang.String recordName, OutputRecord outRec) throws java.io.IOExceptionDescription copied from class:AbstractMetricsContextSends a record to the metrics system.- Specified by:
emitRecordin classAbstractMetricsContext- Throws:
java.io.IOException
-
emitMetric
protected void emitMetric(java.lang.String name, java.lang.String type, java.lang.String value) throws java.io.IOException- Throws:
java.io.IOException
-
getUnits
protected java.lang.String getUnits(java.lang.String metricName)
-
getSlope
protected int getSlope(java.lang.String metricName)
-
getTmax
protected int getTmax(java.lang.String metricName)
-
getDmax
protected int getDmax(java.lang.String metricName)
-
xdr_string
protected void xdr_string(java.lang.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.
-
-