public class ConsoleReporter extends AbstractPollingReporter implements MetricProcessor<PrintStream>
PrintStream
periodically.Constructor and Description |
---|
ConsoleReporter(MetricsRegistry metricsRegistry,
PrintStream out,
MetricPredicate predicate)
Creates a new
ConsoleReporter for a given metrics registry. |
ConsoleReporter(MetricsRegistry metricsRegistry,
PrintStream out,
MetricPredicate predicate,
Clock clock,
TimeZone timeZone)
Creates a new
ConsoleReporter for a given metrics registry. |
ConsoleReporter(MetricsRegistry metricsRegistry,
PrintStream out,
MetricPredicate predicate,
Clock clock,
TimeZone timeZone,
Locale locale)
Creates a new
ConsoleReporter for a given metrics registry. |
ConsoleReporter(PrintStream out)
Creates a new
ConsoleReporter for the default metrics registry, with unrestricted
output. |
Modifier and Type | Method and Description |
---|---|
static void |
enable(long period,
TimeUnit unit)
Enables the console reporter for the default metrics registry, and causes it to print to
STDOUT with the specified period.
|
static void |
enable(MetricsRegistry metricsRegistry,
long period,
TimeUnit unit)
Enables the console reporter for the given metrics registry, and causes it to print to STDOUT
with the specified period and unrestricted output.
|
void |
processCounter(MetricName name,
Counter counter,
PrintStream stream)
Process the given counter.
|
void |
processGauge(MetricName name,
Gauge<?> gauge,
PrintStream stream)
Process the given gauge.
|
void |
processHistogram(MetricName name,
Histogram histogram,
PrintStream stream)
Process the given histogram.
|
void |
processMeter(MetricName name,
Metered meter,
PrintStream stream)
Process the given
Metered instance. |
void |
processTimer(MetricName name,
Timer timer,
PrintStream stream)
Process the given timer.
|
void |
run()
The method called when a a poll is scheduled to occur.
|
shutdown, shutdown, start
getMetricsRegistry
public ConsoleReporter(PrintStream out)
ConsoleReporter
for the default metrics registry, with unrestricted
output.out
- the PrintStream
to which output will be writtenpublic ConsoleReporter(MetricsRegistry metricsRegistry, PrintStream out, MetricPredicate predicate)
ConsoleReporter
for a given metrics registry.metricsRegistry
- the metrics registryout
- the PrintStream
to which output will be writtenpredicate
- the MetricPredicate
used to determine whether a metric will be
outputpublic ConsoleReporter(MetricsRegistry metricsRegistry, PrintStream out, MetricPredicate predicate, Clock clock, TimeZone timeZone)
ConsoleReporter
for a given metrics registry.metricsRegistry
- the metrics registryout
- the PrintStream
to which output will be writtenpredicate
- the MetricPredicate
used to determine whether a metric will be
outputclock
- the Clock
used to print timetimeZone
- the TimeZone
used to print timepublic ConsoleReporter(MetricsRegistry metricsRegistry, PrintStream out, MetricPredicate predicate, Clock clock, TimeZone timeZone, Locale locale)
ConsoleReporter
for a given metrics registry.metricsRegistry
- the metrics registryout
- the PrintStream
to which output will be writtenpredicate
- the MetricPredicate
used to determine whether a metric will be
outputclock
- the Clock
used to print timetimeZone
- the TimeZone
used to print timelocale
- the Locale
used to print valuespublic static void enable(long period, TimeUnit unit)
period
- the period between successive outputsunit
- the time unit of period
public static void enable(MetricsRegistry metricsRegistry, long period, TimeUnit unit)
metricsRegistry
- the metrics registryperiod
- the period between successive outputsunit
- the time unit of period
public void run()
AbstractPollingReporter
run
in interface Runnable
run
in class AbstractPollingReporter
public void processGauge(MetricName name, Gauge<?> gauge, PrintStream stream)
MetricProcessor
processGauge
in interface MetricProcessor<PrintStream>
name
- the name of the gaugegauge
- the gaugestream
- the context of the meterpublic void processCounter(MetricName name, Counter counter, PrintStream stream)
MetricProcessor
processCounter
in interface MetricProcessor<PrintStream>
name
- the name of the countercounter
- the counterstream
- the context of the meterpublic void processMeter(MetricName name, Metered meter, PrintStream stream)
MetricProcessor
Metered
instance.processMeter
in interface MetricProcessor<PrintStream>
name
- the name of the metermeter
- the meterstream
- the context of the meterpublic void processHistogram(MetricName name, Histogram histogram, PrintStream stream)
MetricProcessor
processHistogram
in interface MetricProcessor<PrintStream>
name
- the name of the histogramhistogram
- the histogramstream
- the context of the meterpublic void processTimer(MetricName name, Timer timer, PrintStream stream)
MetricProcessor
processTimer
in interface MetricProcessor<PrintStream>
name
- the name of the timertimer
- the timerstream
- the context of the meterCopyright © 2012. All Rights Reserved.