Package net.spy.memcached.metrics
Interface MetricCollector
- All Known Implementing Classes:
AbstractMetricCollector
,DefaultMetricCollector
,NoopMetricCollector
public interface MetricCollector
Defines a common API for all
MetricCollector
s.
The MetricCollector
interface is used throughout the library,
independent of the actual underlying implementation. See the
DefaultMetricCollector
for a real implementation and the
NoopMetricCollector
for a discarding collector that has no
runtime overhead.
Please note that the implementation is not expected to raise any kind of error if the metric does not exist. To keep the actual application code short, no extra checking needs to be done. If the counter has not been added before, the value should be discarded. An error message can be logged though.
-
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) Decrement a Counter by one.void
decrementCounter
(String name, int amount) Decrement a Counter by the given amount.void
incrementCounter
(String name) Increment a Counter by one.void
incrementCounter
(String name, int amount) Increment a Counter by the given amount.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.
-
Method Details
-
addCounter
Add a Counter to the collector.- Parameters:
name
- the name of the counter.
-
removeCounter
Remove a Counter from the collector.- Parameters:
name
- the name of the counter.
-
incrementCounter
Increment a Counter by one.- Parameters:
name
- the name of the counter.
-
incrementCounter
Increment a Counter by the given amount.- Parameters:
name
- the name of the counter.amount
- the amount to increase.
-
decrementCounter
Decrement a Counter by one.- Parameters:
name
- the name of the counter.
-
decrementCounter
Decrement a Counter by the given amount.- Parameters:
name
- the name of the counter.amount
- the amount to decrease.
-
addMeter
Add a Meter to the Collector.- Parameters:
name
- the name of the counter.
-
removeMeter
Remove a Meter from the Collector.- Parameters:
name
- the name of the counter.
-
markMeter
Mark a checkpoint in the Meter.- Parameters:
name
- the name of the counter.
-
addHistogram
Add a Histogram to the Collector.- Parameters:
name
- the name of the counter.
-
removeHistogram
Remove a Histogram from the Collector.- Parameters:
name
- the name of the counter.
-
updateHistogram
Update the Histogram with the given amount.- Parameters:
name
- the name of the counter.amount
- the amount to update.
-