Class MessageChannelMetricWriter
- java.lang.Object
- org.springframework.boot.actuate.metrics.writer.MessageChannelMetricWriter
- All Implemented Interfaces:
CounterWriter
,GaugeWriter
,MetricWriter
public class MessageChannelMetricWriter extends Object implements MetricWriter
AMetricWriter
that publishes the metric updates on aMessageChannel
. The messages have the writer input (Delta
orMetric
) as payload, and carry an additional header "metricName" with the name of the metric in it.- See Also:
MetricWriterMessageHandler
Constructor Summary
Constructors Constructor Description MessageChannelMetricWriter(org.springframework.messaging.MessageChannel channel)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
Constructor Detail
MessageChannelMetricWriter
public MessageChannelMetricWriter(org.springframework.messaging.MessageChannel channel)
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<?> value)
Description copied from interface:GaugeWriter
Set the value of a metric.- Specified by:
set
in interfaceGaugeWriter
- Parameters:
value
- 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