Class PrefixMetricGroupExporter
- java.lang.Object
- org.springframework.boot.actuate.metrics.export.AbstractMetricExporter
- org.springframework.boot.actuate.metrics.export.PrefixMetricGroupExporter
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,Exporter
public class PrefixMetricGroupExporter extends AbstractMetricExporter
A convenient exporter for a group of metrics from aPrefixMetricReader
. Exports all metrics whose name starts with a prefix (or all metrics if the prefix is empty).- Since:
- 1.3.0
Constructor Summary
Constructors Constructor Description PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer)
Create a new exporter for metrics to a writer based on an empty prefix for the metric names.PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer, String prefix)
Create a new exporter for metrics to a writer based on a prefix for the metric names.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Iterable<String>
groups()
Generate a group of metrics to iterate over in the form of a set of Strings (e.g.protected Iterable<Metric<?>>
next(String group)
Get the next group of metrics to write.void
setGroups(Set<String> groups)
The groups to export.protected void
write(String group, Collection<Metric<?>> values)
Write the values associated with a group.Methods inherited from class org.springframework.boot.actuate.metrics.export.AbstractMetricExporter
close, export, flush, setEarliestTimestamp, setIgnoreTimestamps, setSendLatest
Constructor Detail
PrefixMetricGroupExporter
public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer)
Create a new exporter for metrics to a writer based on an empty prefix for the metric names.- Parameters:
reader
- a reader as the source of metricswriter
- the writer to send the metrics to
PrefixMetricGroupExporter
public PrefixMetricGroupExporter(PrefixMetricReader reader, PrefixMetricWriter writer, String prefix)
Create a new exporter for metrics to a writer based on a prefix for the metric names.- Parameters:
reader
- a reader as the source of metricswriter
- the writer to send the metrics toprefix
- the prefix for metrics to export
Method Detail
setGroups
public void setGroups(Set<String> groups)
The groups to export.- Parameters:
groups
- the groups to set
groups
protected Iterable<String> groups()
Description copied from class:AbstractMetricExporter
Generate a group of metrics to iterate over in the form of a set of Strings (e.g. prefixes). If the metrics to be exported partition into groups identified by a String, subclasses should override this method. Otherwise the default should be fine (iteration over all metrics).- Overrides:
groups
in classAbstractMetricExporter
- Returns:
- groups of metrics to iterate over (default singleton empty string)
next
protected Iterable<Metric<?>> next(String group)
Description copied from class:AbstractMetricExporter
Get the next group of metrics to write.- Specified by:
next
in classAbstractMetricExporter
- Parameters:
group
- the group name to write- Returns:
- some metrics to write
write
protected void write(String group, Collection<Metric<?>> values)
Description copied from class:AbstractMetricExporter
Write the values associated with a group.- Specified by:
write
in classAbstractMetricExporter
- Parameters:
group
- the group to writevalues
- the values to write