类 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 form aggregate.count.** and aggregate.[anything].**. Counters are summed and anything else (i.e. gauges) are aggregated by choosing the most recent value.
    从以下版本开始:
    1.3.0
    • 方法详细资料

      • 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)
        Default is "d.d" (we assume there is a global prefix of length 2).
        参数:
        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
      • count

        public long count()
        从接口复制的说明: MetricReader
        The number of metrics known to this reader.
        指定者:
        count 在接口中 MetricReader
        返回:
        the number of metrics