StatsdGenericPostProcessor

public class StatsdGenericPostProcessor
extends BasePostProcessor

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


A post processor that processes binary proto statsd reports into key-value pairs by expanding the report as a tree structure.

This processor is agnostic to the type of metric reports it encounters. It also serves as the base class for other statsd post processors by including common code to retrieve and read statsd reports.

Summary

Public constructors

StatsdGenericPostProcessor()

Public methods

processRunMetricsAndLogs( rawMetrics, runLogs)

Implement this method in order to generate a set of new metrics from the existing metrics and logs.

processTestMetricsAndLogs(TestDescription testDescription, testMetrics, testLogs)

Implement this method to post process metrics and logs from each test.

Protected methods

convertProtoMessage(Message reportMessage)

Flatten a proto message to a set of key-value pairs which become metrics.

MetricMeasurement.DataType getMetricType()

Set the metric type to RAW metric.

parseMetricsFromReportList(StatsLog.ConfigMetricsReportList reportList)

Parse metrics from a ConfigMetricsReportList read from a statsd report proto.

Public constructors

StatsdGenericPostProcessor

public StatsdGenericPostProcessor ()

Public methods

processRunMetricsAndLogs

public  processRunMetricsAndLogs ( rawMetrics, 
                 runLogs)

Implement this method in order to generate a set of new metrics from the existing metrics and logs. Only the newly generated metrics should be returned, and with unique key name (no collision with existing keys are allowed).

Parameters
rawMetrics : The set of raw metrics available for the run.

runLogs : The set of log files for the test run.

Returns
The set of newly generated metrics from the run metrics.

processTestMetricsAndLogs

public  processTestMetricsAndLogs (TestDescription testDescription, 
                 testMetrics, 
                 testLogs)

Implement this method to post process metrics and logs from each test. Only the newly generated metrics should be returned, and with unique key name (no collision with existing keys are allowed).

Parameters
testDescription TestDescription: The TestDescription object describing the test.

testMetrics : The set of metrics from the test.

testLogs : The set of files logged during the test.

Returns
The set of newly generated metrics from the test metrics.

Protected methods

convertProtoMessage

protected  convertProtoMessage (Message reportMessage)

Flatten a proto message to a set of key-value pairs which become metrics.

It treats a message as a tree and uses the concatenated path from the root to a non-message value as the key, while the non-message value becomes the metric value. Nodes from repeated fields are distinguished by having a 1-based index number appended to all elements after the first element. The first element is not appended as in most cases only one element is in the list field and having it appear as-is is easier to read.

TODO(b/140432161): Separate this out into a utility should the need arise.

Parameters
reportMessage Message

Returns

getMetricType

protected MetricMeasurement.DataType getMetricType ()

Set the metric type to RAW metric.

Returns
MetricMeasurement.DataType

parseMetricsFromReportList

protected  parseMetricsFromReportList (StatsLog.ConfigMetricsReportList reportList)

Parse metrics from a ConfigMetricsReportList read from a statsd report proto.

This is the main interface for subclasses of this statsd post processor.

Parameters
reportList StatsLog.ConfigMetricsReportList

Returns