Class CompositeMetricWriter
- java.lang.Object
- org.springframework.boot.actuate.metrics.writer.CompositeMetricWriter
- All Implemented Interfaces:
Iterable<MetricWriter>
,CounterWriter
,GaugeWriter
,MetricWriter
public class CompositeMetricWriter extends Object implements MetricWriter, Iterable<MetricWriter>
Composite implementation ofMetricWriter
that just sends its input to all of the delegates that have been registered.
Constructor Summary
Constructors Constructor Description CompositeMetricWriter(List<MetricWriter> writers)
CompositeMetricWriter(MetricWriter... writers)
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).Iterator<MetricWriter>
iterator()
void
reset(String metricName)
Reset the value of a metric, usually to zero value.void
set(Metric<?> value)
Set the value of a metric.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Constructor Detail
CompositeMetricWriter
public CompositeMetricWriter(MetricWriter... writers)
CompositeMetricWriter
public CompositeMetricWriter(List<MetricWriter> writers)
Method Detail
iterator
public Iterator<MetricWriter> iterator()
- Specified by:
iterator
in interfaceIterable<MetricWriter>
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