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
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
FieldsModifier and TypeFieldDescriptionprotected byte[]protected DatagramSocketprotected List<? extends SocketAddress>protected intFields inherited from interface com.mapr.org.apache.hadoop.metrics.MetricsContext
DEFAULT_PERIOD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()method to close the datagram socketprotected voidemitMetric(String name, String type, String value) voidemitRecord(String contextName, String recordName, OutputRecord outRec) Sends a record to the metrics system.protected intprotected intprotected intprotected Stringvoidinit(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(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
-
Field Details
-
buffer
protected byte[] buffer -
offset
protected int offset -
metricsServers
-
datagramSocket
-
-
Constructor Details
-
GangliaContext
@Private public GangliaContext()Creates a new instance of GangliaContext
-
-
Method Details
-
init
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(String contextName, String recordName, OutputRecord outRec) throws IOException Description copied from class:AbstractMetricsContextSends a record to the metrics system.- Specified by:
emitRecordin classAbstractMetricsContext- Throws:
IOException
-
emitMetric
- Throws:
IOException
-
getUnits
-
getSlope
-
getTmax
-
getDmax
-
xdr_string
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.
-