IMetricCollectorReceiver

public interface IMetricCollectorReceiver

com.android.tradefed.device.metric.IMetricCollectorReceiver


Interface for IRemoteTests to implement if they need to get the list of IMetricCollectors for the test run.

Tests implementing this interface will not have their default ITestInvocationListener instrumented with the collectors, they will have to do it themselves via IMetricCollector.init(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.result.ITestInvocationListener).

Some tests mechanisms involved buffering Tradefed callbacks and replaying it at the end (like in ITestSuite), such mechanism would results in the collectors being called during the replay and not during the actual execution. By letting tests runner handle when to use the collectors we can ensure the callbacks being handled at the proper time.

In order to use the collectors, the following pattern can be used:
 for (IMetricCollector collector : config.getMetricCollectors()) {
     originalCollector = collector.init(mModuleInvocationContext, originalCollector);
 }
 
The originalCollector will have all the metric collector wrapped around it to be called in sequence.

Summary

Public methods

abstract void setMetricCollectors( collectors)

Sets the list of IMetricCollectors defined for the test run.

Public methods

setMetricCollectors

public abstract void setMetricCollectors ( collectors)

Sets the list of IMetricCollectors defined for the test run.

Parameters
collectors