Package net.spy.memcached.metrics
Class DefaultMetricCollector
java.lang.Object
net.spy.memcached.metrics.AbstractMetricCollector
net.spy.memcached.metrics.DefaultMetricCollector
- All Implemented Interfaces:
MetricCollector
A
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)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConcurrentHashMap
<String, com.codahale.metrics.Counter> Contains all registeredCounter
s.static final String
Log every 30 seconds to the console by default.static final String
Define an empty directory for the CSV exporter by default.static final String
Use the "console" reporter by default.private ConcurrentHashMap
<String, com.codahale.metrics.Histogram> Contains all registeredHistogram
s.private ConcurrentHashMap
<String, com.codahale.metrics.Meter> Contains all registeredMeter
s.private com.codahale.metrics.MetricRegistry
Holds the registry where all metrics are stored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCounter
(String name) Add a Counter to the collector.void
addHistogram
(String name) Add a Histogram to the Collector.void
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.private void
Initialize the proper metrics Reporter.void
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.Methods inherited from class net.spy.memcached.metrics.AbstractMetricCollector
decrementCounter, incrementCounter
-
Field Details
-
DEFAULT_REPORTER_TYPE
Use the "console" reporter by default.- See Also:
-
DEFAULT_REPORTER_INTERVAL
Log every 30 seconds to the console by default.- See Also:
-
DEFAULT_REPORTER_OUTDIR
Define an empty directory for the CSV exporter by default.- See Also:
-
registry
private com.codahale.metrics.MetricRegistry registryHolds the registry where all metrics are stored. -
counters
Contains all registeredCounter
s. -
meters
Contains all registeredMeter
s. -
histograms
Contains all registeredHistogram
s.
-
-
Constructor Details
-
DefaultMetricCollector
public DefaultMetricCollector()Create a newDefaultMetricCollector
. Note that when this constructor is called, the reporter is also automatically established.
-
-
Method Details
-
initReporter
private void initReporter()Initialize the proper metrics Reporter. -
addCounter
Description copied from interface:MetricCollector
Add a Counter to the collector.- Parameters:
name
- the name of the counter.
-
removeCounter
Description copied from interface:MetricCollector
Remove a Counter from the collector.- Parameters:
name
- the name of the counter.
-
incrementCounter
Description copied from interface:MetricCollector
Increment a Counter by the given amount.- Parameters:
name
- the name of the counter.amount
- the amount to increase.
-
decrementCounter
Description copied from interface:MetricCollector
Decrement a Counter by the given amount.- Parameters:
name
- the name of the counter.amount
- the amount to decrease.
-
addMeter
Description copied from interface:MetricCollector
Add a Meter to the Collector.- Parameters:
name
- the name of the counter.
-
removeMeter
Description copied from interface:MetricCollector
Remove a Meter from the Collector.- Parameters:
name
- the name of the counter.
-
markMeter
Description copied from interface:MetricCollector
Mark a checkpoint in the Meter.- Parameters:
name
- the name of the counter.
-
addHistogram
Description copied from interface:MetricCollector
Add a Histogram to the Collector.- Parameters:
name
- the name of the counter.
-
removeHistogram
Description copied from interface:MetricCollector
Remove a Histogram from the Collector.- Parameters:
name
- the name of the counter.
-
updateHistogram
Description copied from interface:MetricCollector
Update the Histogram with the given amount.- Parameters:
name
- the name of the counter.amount
- the amount to update.
-