Package com.codahale.metrics
Class ConsoleReporter
- java.lang.Object
-
- com.codahale.metrics.ScheduledReporter
-
- com.codahale.metrics.ConsoleReporter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ConsoleReporter extends ScheduledReporter
A reporter which outputs measurements to aPrintStream
, likeSystem.out
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConsoleReporter.Builder
A builder forConsoleReporter
instances.
-
Field Summary
Fields Modifier and Type Field Description private Clock
clock
private static int
CONSOLE_WIDTH
private java.text.DateFormat
dateFormat
private java.util.Locale
locale
private java.io.PrintStream
output
-
Constructor Summary
Constructors Modifier Constructor Description private
ConsoleReporter(MetricRegistry registry, java.io.PrintStream output, java.util.Locale locale, Clock clock, java.util.TimeZone timeZone, java.util.concurrent.TimeUnit rateUnit, java.util.concurrent.TimeUnit durationUnit, MetricFilter filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConsoleReporter.Builder
forRegistry(MetricRegistry registry)
Returns a newConsoleReporter.Builder
forConsoleReporter
.private void
printCounter(java.util.Map.Entry<java.lang.String,Counter> entry)
private void
printGauge(java.util.Map.Entry<java.lang.String,Gauge> entry)
private void
printHistogram(Histogram histogram)
private void
printMeter(Meter meter)
private void
printTimer(Timer timer)
private void
printWithBanner(java.lang.String s, char c)
void
report(java.util.SortedMap<java.lang.String,Gauge> gauges, java.util.SortedMap<java.lang.String,Counter> counters, java.util.SortedMap<java.lang.String,Histogram> histograms, java.util.SortedMap<java.lang.String,Meter> meters, java.util.SortedMap<java.lang.String,Timer> timers)
Called periodically by the polling thread.-
Methods inherited from class com.codahale.metrics.ScheduledReporter
close, convertDuration, convertRate, getDurationUnit, getRateUnit, report, start, stop
-
-
-
-
Field Detail
-
CONSOLE_WIDTH
private static final int CONSOLE_WIDTH
- See Also:
- Constant Field Values
-
output
private final java.io.PrintStream output
-
locale
private final java.util.Locale locale
-
clock
private final Clock clock
-
dateFormat
private final java.text.DateFormat dateFormat
-
-
Constructor Detail
-
ConsoleReporter
private ConsoleReporter(MetricRegistry registry, java.io.PrintStream output, java.util.Locale locale, Clock clock, java.util.TimeZone timeZone, java.util.concurrent.TimeUnit rateUnit, java.util.concurrent.TimeUnit durationUnit, MetricFilter filter)
-
-
Method Detail
-
forRegistry
public static ConsoleReporter.Builder forRegistry(MetricRegistry registry)
Returns a newConsoleReporter.Builder
forConsoleReporter
.- Parameters:
registry
- the registry to report- Returns:
- a
ConsoleReporter.Builder
instance for aConsoleReporter
-
report
public void report(java.util.SortedMap<java.lang.String,Gauge> gauges, java.util.SortedMap<java.lang.String,Counter> counters, java.util.SortedMap<java.lang.String,Histogram> histograms, java.util.SortedMap<java.lang.String,Meter> meters, java.util.SortedMap<java.lang.String,Timer> timers)
Description copied from class:ScheduledReporter
Called periodically by the polling thread. Subclasses should report all the given metrics.- Specified by:
report
in classScheduledReporter
- Parameters:
gauges
- all of the gauges in the registrycounters
- all of the counters in the registryhistograms
- all of the histograms in the registrymeters
- all of the meters in the registrytimers
- all of the timers in the registry
-
printMeter
private void printMeter(Meter meter)
-
printCounter
private void printCounter(java.util.Map.Entry<java.lang.String,Counter> entry)
-
printGauge
private void printGauge(java.util.Map.Entry<java.lang.String,Gauge> entry)
-
printHistogram
private void printHistogram(Histogram histogram)
-
printTimer
private void printTimer(Timer timer)
-
printWithBanner
private void printWithBanner(java.lang.String s, char c)
-
-