Class RedisMultiMetricRepository
- java.lang.Object
- org.springframework.boot.actuate.metrics.repository.redis.RedisMultiMetricRepository
- All Implemented Interfaces:
PrefixMetricReader
,MultiMetricRepository
,PrefixMetricWriter
public class RedisMultiMetricRepository extends Object implements MultiMetricRepository
MultiMetricRepository
implementation backed by a redis store. Metric values are stored as zset values and the timestamps as regular values, both against a key composed of the group name prefixed with a constant prefix (default "spring.groups."). The group names are stored as a zset under "keys." +[prefix]
.
Constructor Summary
Constructors Constructor Description RedisMultiMetricRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
RedisMultiMetricRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory, String prefix)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
countGroups()
The number of groups available in this repository.Iterable<Metric<?>>
findAll(String group)
Find all metrics whose name starts with the given prefix.Iterable<String>
groups()
The names of all the groups known to this repository.void
increment(String group, Delta<?> delta)
Increment the value of a metric (or decrement if the delta is negative).void
reset(String group)
Rest the values of all metrics in the group.void
set(String group, Collection<Metric<?>> values)
Save some metric values and associate them with a group name.
Constructor Detail
RedisMultiMetricRepository
public RedisMultiMetricRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
RedisMultiMetricRepository
public RedisMultiMetricRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory, String prefix)
Method Detail
findAll
public Iterable<Metric<?>> findAll(String group)
Description copied from interface:PrefixMetricReader
Find all metrics whose name starts with the given prefix.- Specified by:
findAll
in interfacePrefixMetricReader
- Parameters:
group
- the prefix for metric names- Returns:
- all metrics with names starting with the prefix
set
public void set(String group, Collection<Metric<?>> values)
Description copied from interface:PrefixMetricWriter
Save some metric values and associate them with a group name.- Specified by:
set
in interfacePrefixMetricWriter
- Parameters:
group
- the name of the groupvalues
- the metric values to save
increment
public void increment(String group, Delta<?> delta)
Description copied from interface:PrefixMetricWriter
Increment the value of a metric (or decrement if the delta is negative). The name of the metric to increment isgroup + "." + delta.name
.- Specified by:
increment
in interfacePrefixMetricWriter
- Parameters:
group
- the name of the groupdelta
- the amount to increment by
groups
public Iterable<String> groups()
Description copied from interface:MultiMetricRepository
The names of all the groups known to this repository.- Specified by:
groups
in interfaceMultiMetricRepository
- Returns:
- all available group names
countGroups
public long countGroups()
Description copied from interface:MultiMetricRepository
The number of groups available in this repository.- Specified by:
countGroups
in interfaceMultiMetricRepository
- Returns:
- the number of groups
reset
public void reset(String group)
Description copied from interface:PrefixMetricWriter
Rest the values of all metrics in the group. Implementations may choose to discard the old values.- Specified by:
reset
in interfacePrefixMetricWriter
- Parameters:
group
- reset the whole group