|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.yammer.metrics.reporting.AbstractReporter
com.yammer.metrics.reporting.AbstractPollingReporter
com.yammer.metrics.reporting.GangliaReporter
public class GangliaReporter
A simple reporter which sends out application metrics to a Ganglia server periodically.
NOTE: this reporter only works with Ganglia 3.1 and greater. The message protocol for earlier versions of Ganglia is different. This code heavily borrows from GangliaWriter in JMXTrans which is based on GangliaContext31 from Hadoop.
| Field Summary | |
|---|---|
boolean |
printVMMetrics
|
| Fields inherited from class com.yammer.metrics.reporting.AbstractReporter |
|---|
metricsRegistry |
| Constructor Summary | |
|---|---|
GangliaReporter(MetricsRegistry metricsRegistry,
String gangliaHost,
int port,
String groupPrefix)
Creates a new GangliaReporter. |
|
GangliaReporter(MetricsRegistry metricsRegistry,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate)
Creates a new GangliaReporter. |
|
GangliaReporter(MetricsRegistry metricsRegistry,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate,
boolean compressPackageNames)
Creates a new GangliaReporter. |
|
GangliaReporter(MetricsRegistry metricsRegistry,
String groupPrefix,
MetricPredicate predicate,
boolean compressPackageNames,
GangliaMessageBuilder gangliaMessageBuilder)
Creates a new GangliaReporter. |
|
GangliaReporter(String gangliaHost,
int port)
Creates a new GangliaReporter. |
|
GangliaReporter(String gangliaHost,
int port,
boolean compressPackageNames)
Creates a new GangliaReporter. |
|
| Method Summary | |
|---|---|
static void |
enable(long period,
TimeUnit unit,
String gangliaHost,
int port)
Enables the ganglia reporter to send data for the default metrics registry to ganglia server with the specified period. |
static void |
enable(long period,
TimeUnit unit,
String gangliaHost,
int port,
boolean compressPackageNames)
Enables the ganglia reporter to send data for the default metrics registry to ganglia server with the specified period. |
static void |
enable(long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix)
Enables the ganglia reporter to send data for the default metrics registry to ganglia server with the specified period. |
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix)
Enables the ganglia reporter to send data for the given metrics registry to ganglia server with the specified period. |
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate)
Enables the ganglia reporter to send data to ganglia server with the specified period. |
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate,
boolean compressPackageNames)
Enables the ganglia reporter to send data to ganglia server with the specified period. |
void |
processCounter(MetricName name,
CounterMetric counter,
String x)
|
void |
processGauge(MetricName name,
GaugeMetric<?> gauge,
String x)
|
void |
processHistogram(MetricName name,
HistogramMetric histogram,
String x)
|
void |
processMeter(MetricName name,
Metered meter,
String x)
|
void |
processTimer(MetricName name,
TimerMetric timer,
String x)
|
void |
run()
|
protected String |
sanitizeName(MetricName name)
|
| Methods inherited from class com.yammer.metrics.reporting.AbstractPollingReporter |
|---|
shutdown, shutdown, start |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public boolean printVMMetrics
| Constructor Detail |
|---|
public GangliaReporter(String gangliaHost,
int port)
throws IOException
GangliaReporter.
gangliaHost - is ganglia serverport - is port on which ganglia server is running
IOException - if there is an error connecting to the ganglia server
public GangliaReporter(String gangliaHost,
int port,
boolean compressPackageNames)
throws IOException
GangliaReporter.
gangliaHost - is ganglia serverport - is port on which ganglia server is runningcompressPackageNames -
IOException - if there is an error connecting to the ganglia server
public GangliaReporter(MetricsRegistry metricsRegistry,
String gangliaHost,
int port,
String groupPrefix)
throws IOException
GangliaReporter.
metricsRegistry - the metrics registrygangliaHost - is ganglia serverport - is port on which ganglia server is runninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)
IOException - if there is an error connecting to the ganglia server
public GangliaReporter(MetricsRegistry metricsRegistry,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate)
throws IOException
GangliaReporter.
metricsRegistry - the metrics registrygangliaHost - is ganglia serverport - is port on which ganglia server is runninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)predicate - filters metrics to be reported
IOException - if there is an error connecting to the ganglia server
public GangliaReporter(MetricsRegistry metricsRegistry,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate,
boolean compressPackageNames)
throws IOException
GangliaReporter.
metricsRegistry - the metrics registrygangliaHost - is ganglia serverport - is port on which ganglia server is runninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)predicate - filters metrics to be reportedcompressPackageNames - if true reporter will compress package names e.g.
com.foo.MetricName becomes c.f.MetricName
IOException - if there is an error connecting to the ganglia server
public GangliaReporter(MetricsRegistry metricsRegistry,
String groupPrefix,
MetricPredicate predicate,
boolean compressPackageNames,
GangliaMessageBuilder gangliaMessageBuilder)
throws IOException
GangliaReporter.
metricsRegistry - the metrics registrygroupPrefix - prefix to the ganglia group name (such as myapp_counter)predicate - filters metrics to be reportedcompressPackageNames - if true reporter will compress package names e.g.
com.foo.MetricName becomes c.f.MetricName
IOException - if there is an error connecting to the ganglia server| Method Detail |
|---|
public static void enable(long period,
TimeUnit unit,
String gangliaHost,
int port)
period - the period between successive outputsunit - the time unit of periodgangliaHost - the gangliaHost name of ganglia server (carbon-cache agent)port - the port number on which the ganglia server is listening
public static void enable(long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix)
period - the period between successive outputsunit - the time unit of periodgangliaHost - the gangliaHost name of ganglia server (carbon-cache agent)port - the port number on which the ganglia server is listeninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)
public static void enable(long period,
TimeUnit unit,
String gangliaHost,
int port,
boolean compressPackageNames)
period - the period between successive outputsunit - the time unit of periodgangliaHost - the gangliaHost name of ganglia server (carbon-cache agent)port - the port number on which the ganglia server is listeningcompressPackageNames - if true reporter will compress package names e.g.
com.foo.MetricName becomes c.f.MetricName
public static void enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix)
metricsRegistry - the metrics registryperiod - the period between successive outputsunit - the time unit of periodgangliaHost - the gangliaHost name of ganglia server (carbon-cache agent)port - the port number on which the ganglia server is listeninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)
public static void enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate)
metricsRegistry - the metrics registryperiod - the period between successive outputsunit - the time unit of periodgangliaHost - the gangliaHost name of ganglia server (carbon-cache agent)port - the port number on which the ganglia server is listeninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)predicate - filters metrics to be reported
public static void enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String gangliaHost,
int port,
String groupPrefix,
MetricPredicate predicate,
boolean compressPackageNames)
metricsRegistry - the metrics registryperiod - the period between successive outputsunit - the time unit of periodgangliaHost - the gangliaHost name of ganglia server (carbon-cache agent)port - the port number on which the ganglia server is listeninggroupPrefix - prefix to the ganglia group name (such as myapp_counter)predicate - filters metrics to be reportedcompressPackageNames - if true reporter will compress package names e.g.
com.foo.MetricName becomes c.f.MetricNamepublic void run()
run in interface Runnable
public void processGauge(MetricName name,
GaugeMetric<?> gauge,
String x)
throws IOException
processGauge in interface MetricsProcessor<String>IOException
public void processCounter(MetricName name,
CounterMetric counter,
String x)
throws IOException
processCounter in interface MetricsProcessor<String>IOException
public void processMeter(MetricName name,
Metered meter,
String x)
throws IOException
processMeter in interface MetricsProcessor<String>IOException
public void processHistogram(MetricName name,
HistogramMetric histogram,
String x)
throws IOException
processHistogram in interface MetricsProcessor<String>IOException
public void processTimer(MetricName name,
TimerMetric timer,
String x)
throws IOException
processTimer in interface MetricsProcessor<String>IOExceptionprotected String sanitizeName(MetricName name)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||