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.
|
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 |
reset(String metricName)
Reset the value of a metric, usually to zero value.
|
void |
save(String group,
Collection<Metric<?>> values)
Save some metric values and associate them with a group name.
|
void |
set(Metric<?> value)
Set the value of a metric.
|
void |
setValues(ConcurrentNavigableMap<String,Metric<?>> values) |
public void setValues(ConcurrentNavigableMap<String,Metric<?>> values)
public void increment(Delta<?> delta)
MetricWriter
increment
in interface MetricWriter
delta
- the amount to increment bypublic void set(Metric<?> value)
MetricWriter
set
in interface MetricWriter
public void save(String group, Collection<Metric<?>> values)
MultiMetricRepository
save
in interface MultiMetricRepository
group
- the name of the groupvalues
- the metric values to savepublic Iterable<String> groups()
MultiMetricRepository
groups
in interface MultiMetricRepository
public long count()
MetricReader
count
in interface MetricReader
count
in interface MultiMetricRepository
public void reset(String metricName)
MetricWriter
reset
in interface MultiMetricRepository
reset
in interface MetricWriter
metricName
- the name to resetpublic Metric<?> findOne(String metricName)
MetricReader
findOne
in interface MetricReader
metricName
- the name of the metric to findpublic Iterable<Metric<?>> findAll()
MetricReader
findAll
in interface MetricReader
public Iterable<Metric<?>> findAll(String metricNamePrefix)
PrefixMetricReader
findAll
in interface PrefixMetricReader
metricNamePrefix
- the prefix for metric namesCopyright © 2014 Pivotal Software, Inc.. All rights reserved.