Class InMemoryMultiMetricRepository
- java.lang.Object
- org.springframework.boot.actuate.metrics.repository.InMemoryMultiMetricRepository
- All Implemented Interfaces:
PrefixMetricReader
,MultiMetricRepository
,PrefixMetricWriter
public class InMemoryMultiMetricRepository extends Object implements MultiMetricRepository
MultiMetricRepository
implementation backed by aInMemoryMetricRepository
.- Since:
- 1.5.0
Constructor Summary
Constructors Constructor Description InMemoryMultiMetricRepository()
Create a newInMemoryMetricRepository
backed by a newInMemoryMetricRepository
.InMemoryMultiMetricRepository(InMemoryMetricRepository repository)
Create a newInMemoryMetricRepository
backed by the specifiedInMemoryMetricRepository
.
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 metricNamePrefix)
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
InMemoryMultiMetricRepository
public InMemoryMultiMetricRepository()
Create a newInMemoryMetricRepository
backed by a newInMemoryMetricRepository
.
InMemoryMultiMetricRepository
public InMemoryMultiMetricRepository(InMemoryMetricRepository repository)
Create a newInMemoryMetricRepository
backed by the specifiedInMemoryMetricRepository
.- Parameters:
repository
- the backing repository
Method Detail
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
findAll
public Iterable<Metric<?>> findAll(String metricNamePrefix)
Description copied from interface:PrefixMetricReader
Find all metrics whose name starts with the given prefix.- Specified by:
findAll
in interfacePrefixMetricReader
- Parameters:
metricNamePrefix
- the prefix for metric names- Returns:
- all metrics with names starting with the prefix