Class InMemoryRichGaugeRepository
- java.lang.Object
- org.springframework.boot.actuate.metrics.rich.InMemoryRichGaugeRepository
- All Implemented Interfaces:
RichGaugeReader
,RichGaugeRepository
,CounterWriter
,GaugeWriter
,MetricWriter
public class InMemoryRichGaugeRepository extends Object implements RichGaugeRepository
In memory implementation ofMetricWriter
andRichGaugeReader
. When youset
orincrement
a metric value it is used to update aRichGauge
. Gauge values can then be read out using the reader operations.
Constructor Summary
Constructors Constructor Description InMemoryRichGaugeRepository()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
count()
Return the number of gauge values available.Iterable<RichGauge>
findAll()
Find all instances of rich gauge known to this reader.RichGauge
findOne(String metricName)
Find a single instance of a rich gauge by name.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<?> metric)
Set the value of a metric.
Constructor Detail
InMemoryRichGaugeRepository
public InMemoryRichGaugeRepository()
Method Detail
increment
public void increment(Delta<?> delta)
Description copied from interface:CounterWriter
Increment the value of a metric (or decrement if the delta is negative). The name of the delta is the name of the metric to increment.- Specified by:
increment
in interfaceCounterWriter
- Parameters:
delta
- the amount to increment by
set
public void set(Metric<?> metric)
Description copied from interface:GaugeWriter
Set the value of a metric.- Specified by:
set
in interfaceGaugeWriter
- Parameters:
metric
- the value
reset
public void reset(String metricName)
Description copied from interface:CounterWriter
Reset the value of a metric, usually to zero value. Implementations can discard the old values if desired, but may choose not to. This operation is optional (some implementations may not be able to fulfill the contract, in which case they should simply do nothing).- Specified by:
reset
in interfaceCounterWriter
- Parameters:
metricName
- the name to reset
findOne
public RichGauge findOne(String metricName)
Description copied from interface:RichGaugeReader
Find a single instance of a rich gauge by name.- Specified by:
findOne
in interfaceRichGaugeReader
- Parameters:
metricName
- the name of the gauge- Returns:
- a rich gauge value
findAll
public Iterable<RichGauge> findAll()
Description copied from interface:RichGaugeReader
Find all instances of rich gauge known to this reader.- Specified by:
findAll
in interfaceRichGaugeReader
- Returns:
- all instances known to this reader
count
public long count()
Description copied from interface:RichGaugeReader
Return the number of gauge values available.- Specified by:
count
in interfaceRichGaugeReader
- Returns:
- the number of values