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 classConsoleReporter.BuilderA builder forConsoleReporterinstances.
-
Field Summary
Fields Modifier and Type Field Description private Clockclockprivate static intCONSOLE_WIDTHprivate java.text.DateFormatdateFormatprivate java.util.Localelocaleprivate java.io.PrintStreamoutput
-
Constructor Summary
Constructors Modifier Constructor Description privateConsoleReporter(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.BuilderforRegistry(MetricRegistry registry)Returns a newConsoleReporter.BuilderforConsoleReporter.private voidprintCounter(java.util.Map.Entry<java.lang.String,Counter> entry)private voidprintGauge(java.util.Map.Entry<java.lang.String,Gauge> entry)private voidprintHistogram(Histogram histogram)private voidprintMeter(Meter meter)private voidprintTimer(Timer timer)private voidprintWithBanner(java.lang.String s, char c)voidreport(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.BuilderforConsoleReporter.- Parameters:
registry- the registry to report- Returns:
- a
ConsoleReporter.Builderinstance 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:ScheduledReporterCalled periodically by the polling thread. Subclasses should report all the given metrics.- Specified by:
reportin 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)
-
-