public final class DefaultMetricCollector extends AbstractMetricCollector
MetricCollector
that uses the Codahale Metrics library.
The following system properies can be used to customize the behavior
of the collector during runtime:
- net.spy.metrics.reporter.type = console (console/jmx/csv/slf4j) - net.spy.metrics.reporter.interval = 30 (time interval to log) - net.spy.metrics.reporter.outdir = ~/mydir (output dir for csv reporter)
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_REPORTER_INTERVAL
Log every 30 seconds to the console by default.
|
static String |
DEFAULT_REPORTER_OUTDIR
Define an empty directory for the CSV exporter by default.
|
static String |
DEFAULT_REPORTER_TYPE
Use the "console" reporter by default.
|
Constructor and Description |
---|
DefaultMetricCollector()
Create a new
DefaultMetricCollector . |
Modifier and Type | Method and Description |
---|---|
void |
addCounter(String name)
Add a Counter to the collector.
|
void |
addHistogram(String name)
Add a Histogram to the Collector.
|
void |
addMeter(String name)
Add a Meter to the Collector.
|
void |
decrementCounter(String name,
int amount)
Decrement a Counter by the given amount.
|
void |
incrementCounter(String name,
int amount)
Increment a Counter by the given amount.
|
void |
markMeter(String name)
Mark a checkpoint in the Meter.
|
void |
removeCounter(String name)
Remove a Counter from the collector.
|
void |
removeHistogram(String name)
Remove a Histogram from the Collector.
|
void |
removeMeter(String name)
Remove a Meter from the Collector.
|
void |
updateHistogram(String name,
int amount)
Update the Histogram with the given amount.
|
decrementCounter, incrementCounter
public static final String DEFAULT_REPORTER_TYPE
public static final String DEFAULT_REPORTER_INTERVAL
public static final String DEFAULT_REPORTER_OUTDIR
public DefaultMetricCollector()
DefaultMetricCollector
.
Note that when this constructor is called, the reporter is also
automatically established.public void addCounter(String name)
MetricCollector
name
- the name of the counter.public void removeCounter(String name)
MetricCollector
name
- the name of the counter.public void incrementCounter(String name, int amount)
MetricCollector
name
- the name of the counter.amount
- the amount to increase.public void decrementCounter(String name, int amount)
MetricCollector
name
- the name of the counter.amount
- the amount to decrease.public void addMeter(String name)
MetricCollector
name
- the name of the counter.public void removeMeter(String name)
MetricCollector
name
- the name of the counter.public void markMeter(String name)
MetricCollector
name
- the name of the counter.public void addHistogram(String name)
MetricCollector
name
- the name of the counter.public void removeHistogram(String name)
MetricCollector
name
- the name of the counter.public void updateHistogram(String name, int amount)
MetricCollector
name
- the name of the counter.amount
- the amount to update.Copyright © 2018. All rights reserved.