public class InMemoryMetricRepository extends Object implements MetricRepository, MultiMetricRepository, PrefixMetricReader
MetricRepository and MultiMetricRepository implementation that stores
metrics in memory.| Constructor and Description |
|---|
InMemoryMetricRepository() |
| Modifier and Type | Method and Description |
|---|---|
long |
count()
The number of metrics known to this reader.
|
long |
countGroups() |
Iterable<Metric<?>> |
findAll()
Find all the metrics known to this reader.
|
Iterable<Metric<?>> |
findAll(String metricNamePrefix)
Find all metrics whose name starts with the given prefix.
|
Metric<?> |
findOne(String metricName)
Find an instance of the metric with the given name (usually the latest recorded
value).
|
Iterable<String> |
groups()
The names of all the groups known to this repository
|
void |
increment(Delta<?> delta)
Increment the value of a metric (or decrement if the delta is negative).
|
void |
increment(String group,
Delta<?> delta)
Increment the value of a metric (or decrement if the delta is negative).
|
void |
reset(String metricName)
Reset the value of a metric, usually to zero value.
|
void |
set(Metric<?> value)
Set the value of a metric.
|
void |
set(String group,
Collection<Metric<?>> values)
Save some metric values and associate them with a group name.
|
void |
setValues(ConcurrentNavigableMap<String,Metric<?>> values) |
public void setValues(ConcurrentNavigableMap<String,Metric<?>> values)
public void increment(Delta<?> delta)
MetricWriterincrement in interface MetricWriterdelta - the amount to increment bypublic void set(Metric<?> value)
MetricWriterset in interface MetricWriterpublic void set(String group, Collection<Metric<?>> values)
PrefixMetricWriterset in interface PrefixMetricWritergroup - the name of the groupvalues - the metric values to savepublic void increment(String group, Delta<?> delta)
PrefixMetricWritergroup + "." + delta.name.increment in interface PrefixMetricWriterdelta - the amount to increment bypublic Iterable<String> groups()
MultiMetricRepositorygroups in interface MultiMetricRepositorypublic long count()
MetricReadercount in interface MetricReaderpublic long countGroups()
countGroups in interface MultiMetricRepositorypublic void reset(String metricName)
MetricWriterreset in interface MetricWriterreset in interface PrefixMetricWritermetricName - the name to resetpublic Metric<?> findOne(String metricName)
MetricReaderfindOne in interface MetricReadermetricName - the name of the metric to findpublic Iterable<Metric<?>> findAll()
MetricReaderfindAll in interface MetricReaderpublic Iterable<Metric<?>> findAll(String metricNamePrefix)
PrefixMetricReaderfindAll in interface PrefixMetricReadermetricNamePrefix - the prefix for metric namesCopyright © 2014 Pivotal Software, Inc.. All rights reserved.