public class RedisMetricRepository extends Object implements MetricRepository
MetricRepository implementation for a redis backend. Metric values are stored
as regular hash values against a key composed of the metric name prefixed with a
constant (default "spring.metrics.").| Constructor and Description |
|---|
RedisMetricRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory) |
| 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.
|
Metric<?> |
findOne(String metricName)
Find an instance of the metric with the given name (usually the latest recorded
value).
|
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 |
set(Metric<?> value)
Set the value of a metric.
|
void |
setKey(String key)
The redis key to use to store the index of other keys.
|
void |
setPrefix(String prefix)
The prefix for all metrics keys.
|
public RedisMetricRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
public void setPrefix(String prefix)
prefix - the prefix to set for all metrics keyspublic void setKey(String key)
findAll() and count(), will be much more efficient if the key is
unique to the prefix of this repository.key - the key to setpublic Metric<?> findOne(String metricName)
MetricReaderfindOne in interface MetricReadermetricName - the name of the metric to findpublic Iterable<Metric<?>> findAll()
MetricReaderfindAll in interface MetricReaderpublic long count()
MetricReadercount in interface MetricReaderpublic void increment(Delta<?> delta)
MetricWriterincrement in interface MetricWriterdelta - the amount to increment bypublic void set(Metric<?> value)
MetricWriterset in interface MetricWriterpublic void reset(String metricName)
MetricWriterreset in interface MetricWritermetricName - the name to resetCopyright © 2014 Pivotal Software, Inc.. All rights reserved.