public class GraphiteReporter extends AbstractPollingReporter implements MetricProcessor<Long>
| Modifier and Type | Class and Description |
|---|---|
static class |
GraphiteReporter.DefaultSocketProvider |
| Modifier and Type | Field and Description |
|---|---|
protected Clock |
clock |
protected Locale |
locale |
protected MetricPredicate |
predicate |
protected String |
prefix |
boolean |
printVMMetrics |
protected SocketProvider |
socketProvider |
protected VirtualMachineMetrics |
vm |
protected Writer |
writer |
| Constructor and Description |
|---|
GraphiteReporter(MetricsRegistry metricsRegistry,
String host,
int port,
String prefix)
Creates a new
GraphiteReporter. |
GraphiteReporter(MetricsRegistry metricsRegistry,
String prefix,
MetricPredicate predicate,
SocketProvider socketProvider,
Clock clock)
Creates a new
GraphiteReporter. |
GraphiteReporter(MetricsRegistry metricsRegistry,
String prefix,
MetricPredicate predicate,
SocketProvider socketProvider,
Clock clock,
VirtualMachineMetrics vm)
Creates a new
GraphiteReporter. |
GraphiteReporter(MetricsRegistry metricsRegistry,
String prefix,
MetricPredicate predicate,
SocketProvider socketProvider,
Clock clock,
VirtualMachineMetrics vm,
String name)
Creates a new
GraphiteReporter. |
GraphiteReporter(String host,
int port,
String prefix)
Creates a new
GraphiteReporter. |
| Modifier and Type | Method and Description |
|---|---|
static void |
enable(long period,
TimeUnit unit,
String host,
int port)
Enables the graphite reporter to send data for the default metrics registry to graphite
server with the specified period.
|
static void |
enable(long period,
TimeUnit unit,
String host,
int port,
String prefix)
Enables the graphite reporter to send data to graphite server with the specified period.
|
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String host,
int port)
Enables the graphite reporter to send data for the given metrics registry to graphite server
with the specified period.
|
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String host,
int port,
String prefix)
Enables the graphite reporter to send data to graphite server with the specified period.
|
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit,
String host,
int port,
String prefix,
MetricPredicate predicate)
Enables the graphite reporter to send data to graphite server with the specified period.
|
protected void |
printRegularMetrics(Long epoch) |
protected void |
printVmMetrics(long epoch) |
void |
processCounter(MetricName name,
Counter counter,
Long epoch) |
void |
processGauge(MetricName name,
Gauge<?> gauge,
Long epoch) |
void |
processHistogram(MetricName name,
Histogram histogram,
Long epoch) |
void |
processMeter(MetricName name,
Metered meter,
Long epoch) |
void |
processTimer(MetricName name,
Timer timer,
Long epoch) |
void |
run() |
protected String |
sanitizeName(MetricName name) |
protected String |
sanitizeString(String s) |
protected void |
sendFloat(long timestamp,
String name,
String valueName,
double value) |
protected void |
sendInt(long timestamp,
String name,
String valueName,
long value) |
protected void |
sendObjToGraphite(long timestamp,
String name,
String valueName,
Object value) |
protected void |
sendSampling(long epoch,
String sanitizedName,
Sampling metric) |
protected void |
sendSummarizable(long epoch,
String sanitizedName,
Summarizable metric) |
protected void |
sendToGraphite(long timestamp,
String name,
String value) |
shutdown, shutdown, startgetMetricsRegistryprotected final String prefix
protected final MetricPredicate predicate
protected final Locale locale
protected final Clock clock
protected final SocketProvider socketProvider
protected final VirtualMachineMetrics vm
protected Writer writer
public boolean printVMMetrics
public GraphiteReporter(String host, int port, String prefix) throws IOException
GraphiteReporter.host - is graphite serverport - is port on which graphite server is runningprefix - is prepended to all names reported to graphiteIOException - if there is an error connecting to the Graphite serverpublic GraphiteReporter(MetricsRegistry metricsRegistry, String host, int port, String prefix) throws IOException
GraphiteReporter.metricsRegistry - the metrics registryhost - is graphite serverport - is port on which graphite server is runningprefix - is prepended to all names reported to graphiteIOException - if there is an error connecting to the Graphite serverpublic GraphiteReporter(MetricsRegistry metricsRegistry, String prefix, MetricPredicate predicate, SocketProvider socketProvider, Clock clock) throws IOException
GraphiteReporter.metricsRegistry - the metrics registryprefix - is prepended to all names reported to graphitepredicate - filters metrics to be reportedsocketProvider - a SocketProvider instanceclock - a Clock instanceIOException - if there is an error connecting to the Graphite serverpublic GraphiteReporter(MetricsRegistry metricsRegistry, String prefix, MetricPredicate predicate, SocketProvider socketProvider, Clock clock, VirtualMachineMetrics vm) throws IOException
GraphiteReporter.metricsRegistry - the metrics registryprefix - is prepended to all names reported to graphitepredicate - filters metrics to be reportedsocketProvider - a SocketProvider instanceclock - a Clock instancevm - a VirtualMachineMetrics instanceIOException - if there is an error connecting to the Graphite serverpublic GraphiteReporter(MetricsRegistry metricsRegistry, String prefix, MetricPredicate predicate, SocketProvider socketProvider, Clock clock, VirtualMachineMetrics vm, String name) throws IOException
GraphiteReporter.metricsRegistry - the metrics registryprefix - is prepended to all names reported to graphitepredicate - filters metrics to be reportedsocketProvider - a SocketProvider instanceclock - a Clock instancevm - a VirtualMachineMetrics instanceIOException - if there is an error connecting to the Graphite serverpublic static void enable(long period,
TimeUnit unit,
String host,
int port)
period - the period between successive outputsunit - the time unit of periodhost - the host name of graphite server (carbon-cache agent)port - the port number on which the graphite server is listeningpublic static void enable(MetricsRegistry metricsRegistry, long period, TimeUnit unit, String host, int port)
metricsRegistry - the metrics registryperiod - the period between successive outputsunit - the time unit of periodhost - the host name of graphite server (carbon-cache agent)port - the port number on which the graphite server is listeningpublic static void enable(long period,
TimeUnit unit,
String host,
int port,
String prefix)
period - the period between successive outputsunit - the time unit of periodhost - the host name of graphite server (carbon-cache agent)port - the port number on which the graphite server is listeningprefix - the string which is prepended to all metric namespublic static void enable(MetricsRegistry metricsRegistry, long period, TimeUnit unit, String host, int port, String prefix)
metricsRegistry - the metrics registryperiod - the period between successive outputsunit - the time unit of periodhost - the host name of graphite server (carbon-cache agent)port - the port number on which the graphite server is listeningprefix - the string which is prepended to all metric namespublic static void enable(MetricsRegistry metricsRegistry, long period, TimeUnit unit, String host, int port, String prefix, MetricPredicate predicate)
metricsRegistry - the metrics registryperiod - the period between successive outputsunit - the time unit of periodhost - the host name of graphite server (carbon-cache agent)port - the port number on which the graphite server is listeningprefix - the string which is prepended to all metric namespredicate - filters metrics to be reportedpublic void run()
run in interface Runnablerun in class AbstractPollingReporterprotected void printRegularMetrics(Long epoch)
protected void sendObjToGraphite(long timestamp,
String name,
String valueName,
Object value)
protected String sanitizeName(MetricName name)
public void processGauge(MetricName name, Gauge<?> gauge, Long epoch) throws IOException
processGauge in interface MetricProcessor<Long>IOExceptionpublic void processCounter(MetricName name, Counter counter, Long epoch) throws IOException
processCounter in interface MetricProcessor<Long>IOExceptionpublic void processMeter(MetricName name, Metered meter, Long epoch) throws IOException
processMeter in interface MetricProcessor<Long>IOExceptionpublic void processHistogram(MetricName name, Histogram histogram, Long epoch) throws IOException
processHistogram in interface MetricProcessor<Long>IOExceptionpublic void processTimer(MetricName name, Timer timer, Long epoch) throws IOException
processTimer in interface MetricProcessor<Long>IOExceptionprotected void sendSummarizable(long epoch,
String sanitizedName,
Summarizable metric)
throws IOException
IOExceptionprotected void sendSampling(long epoch,
String sanitizedName,
Sampling metric)
throws IOException
IOExceptionprotected void printVmMetrics(long epoch)
Copyright © 2012. All Rights Reserved.