public abstract class ScheduledReporter extends Object implements Closeable, Reporter
ConsoleReporter,
CsvReporter,
Slf4jReporter| Modifier | Constructor and Description |
|---|---|
protected |
ScheduledReporter(MetricRegistry registry,
String name,
MetricFilter filter,
TimeUnit rateUnit,
TimeUnit durationUnit)
Creates a new
ScheduledReporter instance. |
protected |
ScheduledReporter(MetricRegistry registry,
String name,
MetricFilter filter,
TimeUnit rateUnit,
TimeUnit durationUnit,
ScheduledExecutorService executor)
Creates a new
ScheduledReporter instance. |
protected |
ScheduledReporter(MetricRegistry registry,
String name,
MetricFilter filter,
TimeUnit rateUnit,
TimeUnit durationUnit,
ScheduledExecutorService executor,
boolean shutdownExecutorOnStop)
Creates a new
ScheduledReporter instance. |
protected |
ScheduledReporter(MetricRegistry registry,
String name,
MetricFilter filter,
TimeUnit rateUnit,
TimeUnit durationUnit,
ScheduledExecutorService executor,
boolean shutdownExecutorOnStop,
Set<MetricAttribute> disabledMetricAttributes) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Stops the reporter and shuts down its thread of execution.
|
protected double |
convertDuration(double duration) |
protected double |
convertRate(double rate) |
protected Set<MetricAttribute> |
getDisabledMetricAttributes() |
protected String |
getDurationUnit() |
protected String |
getRateUnit() |
protected boolean |
isShutdownExecutorOnStop() |
void |
report()
Report the current values of all metrics in the registry.
|
abstract 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.
|
void |
start(long initialDelay,
long period,
TimeUnit unit)
Starts the reporter polling at the given period.
|
void |
start(long period,
TimeUnit unit)
Starts the reporter polling at the given period.
|
void |
stop()
Stops the reporter and if shutdownExecutorOnStop is true then shuts down its thread of execution.
|
protected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit)
ScheduledReporter instance.registry - the MetricRegistry containing the metrics this
reporter will reportname - the reporter's namefilter - the filter for which metrics to reportrateUnit - a unit of timedurationUnit - a unit of timeprotected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit, ScheduledExecutorService executor)
ScheduledReporter instance.registry - the MetricRegistry containing the metrics this
reporter will reportname - the reporter's namefilter - the filter for which metrics to reportexecutor - the executor to use while scheduling reporting of metrics.protected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit, ScheduledExecutorService executor, boolean shutdownExecutorOnStop)
ScheduledReporter instance.registry - the MetricRegistry containing the metrics this
reporter will reportname - the reporter's namefilter - the filter for which metrics to reportexecutor - the executor to use while scheduling reporting of metrics.shutdownExecutorOnStop - if true, then executor will be stopped in same time with this reporterprotected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<MetricAttribute> disabledMetricAttributes)
public void start(long period,
TimeUnit unit)
period - the amount of time between pollsunit - the unit for periodpublic void start(long initialDelay,
long period,
TimeUnit unit)
initialDelay - the time to delay the first executionperiod - the amount of time between pollsunit - the unit for period and initialDelaypublic void stop()
Uses the shutdown pattern from http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html
public void close()
close in interface Closeableclose in interface AutoCloseablepublic void report()
public abstract void report(SortedMap<String,Gauge> gauges, SortedMap<String,Counter> counters, SortedMap<String,Histogram> histograms, SortedMap<String,Meter> meters, SortedMap<String,Timer> timers)
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 registryprotected String getRateUnit()
protected String getDurationUnit()
protected double convertDuration(double duration)
protected double convertRate(double rate)
protected boolean isShutdownExecutorOnStop()
protected Set<MetricAttribute> getDisabledMetricAttributes()
Copyright © 2018. All Rights Reserved.