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_NAME,且 energy_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)

使用 Atom 格式化工具,從 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)

使用 Atom 格式化工具,從 ConfigMetricsReportList 剖析計量表指標。

如果事件指標導致鍵重複,系統會以半形逗號分隔值形式儲存。

參數
reportList StatsLog.ConfigMetricsReportList

傳回
Map<String, MetricMeasurement.Metric.Builder>