org.apache.hadoop.metrics.ganglia
Class GangliaContext

java.lang.Object
  extended by org.apache.hadoop.metrics.spi.AbstractMetricsContext
      extended by org.apache.hadoop.metrics.ganglia.GangliaContext
All Implemented Interfaces:
org.apache.hadoop.metrics.MetricsContext

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class GangliaContext
extends AbstractMetricsContext

Context for sending metrics to Ganglia.


Field Summary
protected  byte[] buffer
           
protected  DatagramSocket datagramSocket
           
protected  List<? extends SocketAddress> metricsServers
           
protected  int offset
           
 
Fields inherited from interface org.apache.hadoop.metrics.MetricsContext
DEFAULT_PERIOD
 
Constructor Summary
GangliaContext()
          Creates a new instance of GangliaContext
 
Method Summary
 void close()
          method to close the datagram socket
protected  void emitMetric(String name, String type, String value)
           
protected  int getDmax(String metricName)
           
protected  int getSlope(String metricName)
           
protected  int getTmax(String metricName)
           
protected  String getUnits(String metricName)
           
protected  void xdr_int(int i)
          Puts an integer into the buffer as 4 bytes, big-endian.
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.
 
Methods inherited from class org.apache.hadoop.metrics.spi.AbstractMetricsContext
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
 

Field Detail

buffer

protected byte[] buffer

offset

protected int offset

metricsServers

protected List<? extends SocketAddress> metricsServers

datagramSocket

protected DatagramSocket datagramSocket
Constructor Detail

GangliaContext

@InterfaceAudience.Private
public GangliaContext()
Creates a new instance of GangliaContext

Method Detail

close

public void close()
method to close the datagram socket

Specified by:
close in interface org.apache.hadoop.metrics.MetricsContext
Overrides:
close in class AbstractMetricsContext

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 © 2014 Apache Software Foundation. All Rights Reserved.