Package com.codahale.metrics
Class ConsoleReporter
java.lang.Object
com.codahale.metrics.ScheduledReporter
com.codahale.metrics.ConsoleReporter
- All Implemented Interfaces:
Closeable
,AutoCloseable
A reporter which outputs measurements to a
PrintStream
, like System.out
.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Clock
private static final int
private final DateFormat
private final Locale
private final PrintStream
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ConsoleReporter
(MetricRegistry registry, PrintStream output, Locale locale, Clock clock, TimeZone timeZone, TimeUnit rateUnit, TimeUnit durationUnit, MetricFilter filter) -
Method Summary
Modifier and TypeMethodDescriptionstatic ConsoleReporter.Builder
forRegistry
(MetricRegistry registry) Returns a newConsoleReporter.Builder
forConsoleReporter
.private void
printCounter
(Map.Entry<String, Counter> entry) private void
printGauge
(Map.Entry<String, Gauge> entry) private void
printHistogram
(Histogram histogram) private void
printMeter
(Meter meter) private void
printTimer
(Timer timer) private void
printWithBanner
(String s, char c) void
report
(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<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 Details
-
CONSOLE_WIDTH
private static final int CONSOLE_WIDTH- See Also:
-
output
-
locale
-
clock
-
dateFormat
-
-
Constructor Details
-
ConsoleReporter
private ConsoleReporter(MetricRegistry registry, PrintStream output, Locale locale, Clock clock, TimeZone timeZone, TimeUnit rateUnit, TimeUnit durationUnit, MetricFilter filter)
-
-
Method Details
-
forRegistry
Returns a newConsoleReporter.Builder
forConsoleReporter
.- Parameters:
registry
- the registry to report- Returns:
- a
ConsoleReporter.Builder
instance for aConsoleReporter
-
report
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<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
-
printCounter
-
printGauge
-
printHistogram
-
printTimer
-
printWithBanner
-