github.phpd.cn/thought-machine/please@v12.2.0+incompatible/src/follow/proto/build_event.proto (about)

     1  // Defines the remote streaming protocol for build events.
     2  syntax = "proto3";
     3  
     4  package proto.build_event;
     5  
     6  service PlzEvents {
     7      // Receives information about the state of the server's configuration.
     8      rpc ServerConfig(ServerConfigRequest) returns (ServerConfigResponse);
     9      // Receives build events from the remote server.
    10      rpc BuildEvents(BuildEventRequest) returns (stream BuildEventResponse);
    11      // Receives a stream of information about the server's resource usage.
    12      rpc ResourceUsage(ResourceUsageRequest) returns (stream ResourceUsageResponse);
    13  }
    14  
    15  message ServerConfigRequest{
    16  }
    17  
    18  message ServerConfigResponse{
    19      // The total number of threads that the server is configured to run.
    20      int32 num_threads = 1;
    21      // The original targets that the server was requested to run.
    22      repeated BuildLabel original_targets = 2;
    23      // True if the server is running tests.
    24      bool tests = 3;
    25      // True if the server is running test coverage.
    26      bool coverage = 4;
    27      // The most recent event for each server thread.
    28      // May be shorter than num_threads since some threads may not have had an event yet.
    29      repeated BuildEventResponse last_events = 5;
    30      // The time that the build started, as nanoseconds since 1970.
    31      int64 start_time = 6;
    32  }
    33  
    34  message BuildEventRequest{
    35  }
    36  
    37  message BuildEventResponse{
    38      // Internal id of the thread (goroutine, really) that generated this event.
    39      // These can be used to chain together consecutive events by the same worker.
    40      // Ids are guaranteed to be allocated sequentially, starting from 0 and are
    41      // strictly less than num_threads in the corresponding ServerConfigResponse.
    42      // You aren't necessarily guaranteed to observe events on any or all threads
    43      // though.
    44      int32 thread_id = 1;
    45      // Timestamp of this event, in nanoseconds since the Unix epoch.
    46      int64 timestamp = 2;
    47      // Build label that this event relates to.
    48      BuildLabel build_label = 3;
    49      // Status of the build.
    50      BuildResultStatus status = 4;
    51      // Error, only populated for failure statuses.
    52      string error = 5;
    53      // Description of what's going on.
    54      string description = 6;
    55      // If the target was a test, this will contain the results of it.
    56      TestResults test_results = 7;
    57      // Labels of the target
    58      repeated string labels = 8;
    59      // Number of tasks that are currently "activated", i.e. to be done before the build ends.
    60      // These are somewhat nebulously defined but can provide a measure of progress, as long as
    61      // you don't mind this number increasing through the build, tasks taking wildly different
    62      // amounts of time, and that there isn't a 1:1 correspondence between tasks and these messages.
    63      int64 num_active = 9;
    64      // Number of tasks that have been completed so far.
    65      int64 num_done = 10;
    66  }
    67  
    68  message BuildLabel{
    69      string package_name = 1;
    70      string name = 2;
    71  }
    72  
    73  // A BuildResultStatus describes what has just happened in the event.
    74  enum BuildResultStatus {
    75      // Build result is unknown. In normal operation this is never set.
    76      Unknown = 0;
    77      // Please is beginning to parse a package.
    78      PackageParsing = 1;
    79      // The package has been parsed successfully.
    80      PackageParsed = 2;
    81      // The package has been parsed, but it failed.
    82      ParseFailed = 3;
    83      // Please has started building a target.
    84      TargetBuilding = 4;
    85      // Please has reached a target, and the input flags requested it to stop here
    86      // i.e. the request was something like plz build --prepare or --shell etc
    87      //      which precludes continuing to actually build the target.
    88      //      This is not a failure state.
    89      TargetBuildStopped = 5;
    90      // The target has been successfully built.
    91      TargetBuilt = 6;
    92      // The target was built by retrieving it from the disk, remote or other cache.
    93      TargetCached = 7;
    94      // The build of the target failed.
    95      TargetBuildFailed = 8;
    96      // Please is beginning to test a target.
    97      TargetTesting = 9;
    98      // The target has finished testing and all tests passed.
    99      TargetTested = 10;
   100      // The target has finished testing but some tests failed.
   101      TargetTestFailed = 11;
   102  }
   103  
   104  message TestResults {
   105      // Total number of test cases in the test target.
   106      int32 num_tests = 1;
   107      // Number of tests that passed outright.
   108      int32 passed = 2;
   109      // Number of tests that failed.
   110      int32 failed = 3;
   111      // Number of tests that were expected to fail (counts as a pass, but displayed differently)
   112      int32 expected_failures = 4;
   113      // Number of tests skipped (also count as passes)
   114      int32 skipped = 5;
   115      // Number of failed attempts to run the test
   116      int32 flakes = 6;
   117      // Tests that failed, if any.
   118      repeated TestFailure failures = 7;
   119      // Names of tests that passed.
   120      repeated string passes = 8;
   121      // Combined stdout / stderr from the test.
   122      string output = 9;
   123      // Duration that the test ran for, in nanoseconds.
   124      int64 duration = 10;
   125      // True if the test results were cached (i.e. it was not actually rerun).
   126      bool cached = 11;
   127      // True if the test failed because we timed it out.
   128      bool timed_out = 12;
   129  }
   130  
   131  message TestFailure {
   132      // Name of the failing test.
   133      string name = 1;
   134      // Type of failure, e.g. the type of exception raised.
   135      string type = 2;
   136      // Traceback of the failure point, if applicable.
   137      string traceback = 3;
   138      // Standard output from this test case.
   139      string stdout = 4;
   140      // Standard error during test.
   141      string stderr = 5;
   142  }
   143  
   144  message ResourceUsageRequest{
   145  }
   146  
   147  message ResourceUsageResponse{
   148      // Total number of CPUs available to the system.
   149      int32 num_cpus = 1;
   150      // CPU usage that is measured as "in use", excluding I/O, as a percentage.
   151      double cpu_use = 2;
   152      // I/O wait, as a percentage of CPU time.
   153      double io_wait = 3;
   154      // Total amount of memory available
   155      uint64 mem_total = 4;
   156      // Total amount of memory in use.
   157      uint64 mem_used = 5;
   158  }