StatsdBeforeAfterGaugeMetricPostProcessor

public class StatsdBeforeAfterGaugeMetricPostProcessor
extends StatsdGenericPostProcessor

java.lang.Object
com.android.tradefed.postprocessor.BasePostProcessor
  com.android.tradefed.postprocessor.StatsdGenericPostProcessor
    com.android.tradefed.postprocessor.StatsdBeforeAfterGaugeMetricPostProcessor


后处理器,用于处理以“之前/之后”方法收集的测量指标,即在测试/运行之前和之后各进行一次 快照,根据提供的指标格式化程序列表提取指标并报告其增量。

以这种方式收集的指标如下所示:(指标位于原子中)

 reports {
   metrics {
     gauge_metrics {
       data {
         # Bucket for the "before" snapshot
         bucket_info {
           atom {...}
           atom {...}
           ...
         }
         # Bucket for the "after" snapshot
         bucket_info {
           atom {...}
           atom {...}
           ...
         }
       }
     }
     ...
   }
   ...
 }
 

例如,如果提供的指标格式化程序对于键为 on_device_power_measurement,对于值为 [subsystem_name]-[rail_name]=[energy_microwatt_secs],则对于 subsystem_namedisplayrail_nameRAIL_NAMEenergy_microwatt_secs10 的原子,指标将如下所示:statsd-<config name>-gauge-on_device_power_measurement-delta-display-RAIL_NAME=10

之前/之后指标按名称进行匹配以计算增量,因此假定 格式化程序将确保每个快照在其内部生成唯一的指标集。在以下情况下,处理器将生成警告:

  • 每个快照中格式化程序生成的指标键重复
  • 一个原子或指标键存在于一个快照中,但不存在于另一个快照中

摘要

公共构造函数

StatsdBeforeAfterGaugeMetricPostProcessor()

受保护的方法

void logFormattedWarning(String message)

围绕 CLog.w() 的封装容器,使测试能够观察格式化后的警告。

Map<String, MetricMeasurement.Metric.Builder> parseMetricsFromReportList(StatsLog.ConfigMetricsReportList reportList)

使用原子格式化程序从 ConfigMetricsReportList 解析测量指标。

公共构造函数

StatsdBeforeAfterGaugeMetricPostProcessor

public StatsdBeforeAfterGaugeMetricPostProcessor ()

受保护的方法

logFormattedWarning

protected void logFormattedWarning (String message)

围绕 CLog.w() 的封装容器,使测试能够观察格式化后的警告。

参数
message String

parseMetricsFromReportList

protected Map<String, MetricMeasurement.Metric.Builder> parseMetricsFromReportList (StatsLog.ConfigMetricsReportList reportList)

使用原子格式化程序从 ConfigMetricsReportList 解析测量指标。

导致键重复的事件指标将存储为以英文逗号分隔的值。

参数
reportList StatsLog.ConfigMetricsReportList

返回值
Map<String, MetricMeasurement.Metric.Builder>