Home | History | Annotate | Download | only in proto
      1 // Should be kept in sync with internal version.
      2 syntax = "proto2";
      3 
      4 package log_collector;
      5 
      6 import public "tools/tradefederation/core/proto/file_metadata.proto";
      7 
      8 option java_package = "com.android.test.metrics.proto";
      9 option java_outer_classname = "LogCollectorProto";
     10 
     11 // Conditions that can trigger log collection.
     12 enum Trigger {
     13   // Never run this collector.
     14   NEVER = 0;
     15 
     16   // Run this collector at the start of a test.
     17   TEST_START = 1;
     18 
     19   // Run this collector when the test finishes.
     20   TEST_FINISH = 2;
     21 
     22   // Run this collector when the test fails.
     23   FAILURE = 3;
     24 
     25   // Run this collector when the test crashes.
     26   CRASH = 4;
     27 
     28   // Run this collector when the test has a tool failure.
     29   TOOL_FAILURE = 5;
     30 
     31   // Run this collector at the given interval.
     32   INTERVAL = 6;
     33 }
     34 
     35 message TestPattern {
     36   // Run this collector for the given build targets. If no build targets are
     37   // specified, we will run the collector on all build targets.
     38   repeated string build_target = 1;
     39 
     40   // Run this collector for tests with the given prefix. If no prefices are
     41   // specified, we will run the collector for all tests.
     42   repeated string atp_test_prefix = 2;
     43 
     44   // Run this collector for tests on the given test bench. If no test bench is
     45   // specified, we will run the collector for all test benches.
     46   repeated string atp_test_bench = 3;
     47 }
     48 
     49 message FormattedFileName {
     50   enum FormatParam {
     51     EMPTY = 0;
     52     TIMESTAMP_EPOCH_MILLIS = 1;
     53     TEST_NAME = 2;
     54     TEST_CLASS = 3;
     55   }
     56 
     57   // A java-style format string, e.g. "logcat-%s.log" or "bugreport-%d.log".
     58   // TIMESTAMP_MILLIS must correspond to %d and the rest must be %s.
     59   required string name_format_string = 1;
     60 
     61   // A FormatParam for each format field.
     62   repeated FormatParam format_params = 2;
     63 
     64   // If true, the results directory will be prepended to this file name.
     65   required bool relative_to_results = 3;
     66 }
     67 
     68 message ShellCommand {
     69   // The base executable (e.g. "dumpsys").
     70   required string executable = 1;
     71 
     72   // Command-line options (e.g. "graphicsstats").
     73   repeated string options = 2;
     74 }
     75 
     76 message ExistingFile {
     77   required string path = 1;
     78 
     79   // If true, the results directory will be prepended to this file name.
     80   optional bool relative_to_results = 2;
     81 }
     82 
     83 message Collector {
     84   // The name of this collector (used only for logging).
     85   required string name = 1;
     86 
     87   // The Trade Federation LogFileType for the resulting log.
     88   required posting_service_rpc.LogType type = 2;
     89 
     90   // The preconditions for this Collector. If none are specified, we'll never
     91   // run it.
     92   repeated Trigger triggers = 3;
     93 
     94   // The test patterns for which we should run this Collector.
     95   // If none are specified, we'll never run it.
     96   repeated TestPattern tests = 4;
     97 
     98   // The interval at which to collect this log, if one of our triggers is
     99   // INTERVAL.
    100   optional uint64 interval_millis = 5;
    101 
    102   // If true, and our test runner can interpret LogCollectors, we will
    103   // forward this collector to the test runner to reduce latency.
    104   optional bool forward_to_test_runner = 6;
    105 
    106   // The way we'll get the log.
    107   oneof source {
    108     ShellCommand command = 7;
    109     ExistingFile file = 8;
    110   }
    111 
    112   // The place we should put the log.
    113   oneof result {
    114     string result_file_name = 9;
    115     FormattedFileName result_file_formatted = 10;
    116   }
    117 }
    118