public class InMemoryMetricRepository extends Object implements MetricRepository, MultiMetricRepository
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()
The number of groups available in this repository.
|
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)
CounterWriterincrement in interface CounterWriterdelta - the amount to increment bypublic void set(Metric<?> value)
GaugeWriterset in interface GaugeWritervalue - the valuepublic 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 PrefixMetricWritergroup - the name of the groupdelta - the amount to increment bypublic Iterable<String> groups()
MultiMetricRepositorygroups in interface MultiMetricRepositorypublic long count()
MetricReadercount in interface MetricReaderpublic long countGroups()
MultiMetricRepositorycountGroups in interface MultiMetricRepositorypublic void reset(String metricName)
CounterWriterreset in interface CounterWriterreset 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 © 2015 Pivotal Software, Inc.. All rights reserved.