类 AggregateMetricReader
- java.lang.Object
- org.springframework.boot.actuate.metrics.aggregate.AggregateMetricReader
- 所有已实现的接口:
MetricReader
public class AggregateMetricReader extends Object implements MetricReader
A metric reader that aggregates values from a source reader, normally one that has been collecting data from many sources in the same form (like a scaled-out application). The source has metrics with names in the form*.*.counter.**
and*.*.[anything].**
, and the result has metric names in the formaggregate.count.**
andaggregate.[anything].**
. Counters are summed and anything else (i.e. gauges) are aggregated by choosing the most recent value.- 从以下版本开始:
- 1.3.0
构造器概要
构造器 构造器 说明 AggregateMetricReader(MetricReader source)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 long
count()
The number of metrics known to this reader.Iterable<Metric<?>>
findAll()
Find all the metrics known to this reader.Metric<?>
findOne(String metricName)
Find an instance of the metric with the given name (usually the latest recorded value).void
setKeyPattern(String keyPattern)
Pattern that tells the aggregator what to do with the keys from the source repository.void
setPrefix(String prefix)
Prefix to apply to all output metrics.
构造器详细资料
AggregateMetricReader
public AggregateMetricReader(MetricReader source)
方法详细资料
setKeyPattern
public void setKeyPattern(String keyPattern)
Pattern that tells the aggregator what to do with the keys from the source repository. The keys in the source repository are assumed to be period separated, and the pattern is in the same format, e.g. "d.d.k.d". The pattern segments are matched against the source keys and a rule is applied:- "d" means "discard" this key segment (useful for global prefixes like system identifiers, or aggregate keys a.k.a. physical identifiers)
- "k" means "keep" it with no change (useful for logical identifiers like app names)
- 参数:
keyPattern
- the keyPattern to set
setPrefix
public void setPrefix(String prefix)
Prefix to apply to all output metrics. A period will be appended if not present in the provided value.- 参数:
prefix
- the prefix to use (default "aggregator.")
findOne
public Metric<?> findOne(String metricName)
从接口复制的说明:MetricReader
Find an instance of the metric with the given name (usually the latest recorded value).- 指定者:
findOne
在接口中MetricReader
- 参数:
metricName
- the name of the metric to find- 返回:
- a metric value or null if there are none with that name
findAll
public Iterable<Metric<?>> findAll()
从接口复制的说明:MetricReader
Find all the metrics known to this reader.- 指定者:
findAll
在接口中MetricReader
- 返回:
- all instances of metrics known to this reader
count
public long count()
从接口复制的说明:MetricReader
The number of metrics known to this reader.- 指定者:
count
在接口中MetricReader
- 返回:
- the number of metrics