github.com/tiagovtristao/plz@v13.4.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 TestSuite 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 TestSuite { 105 // The package name of the test suite. 106 string package = 1; 107 // The name of the test suite. 108 string name = 2; 109 // True if the test results were cached. 110 bool cached = 3; 111 // Duration that the test ran for, in nanoseconds. 112 int64 duration = 4; 113 // True if the test failed due to a timeout. 114 bool timed_out = 5; 115 // The test cases that make up this test suite. 116 repeated TestCase test_cases = 6; 117 // Any system properties that were set at the time of execution. 118 map<string, string> properties = 7; 119 // Timestamp of the start of test execution. 120 string timestamp = 8; 121 } 122 123 message TestCase { 124 // The class name of the test. 125 string class_name = 1; 126 // The name of the test. 127 string name = 2; 128 // The separate executions that make up this test case. 129 repeated TestExecution test_executions = 3; 130 } 131 132 message TestExecution { 133 // The failure, if any, from this attempt at running the test. 134 TestFailure failure = 1; 135 // The error, if any, from this attempt at running the test. 136 TestFailure error = 2; 137 // The reason for skipping the test, if any. 138 TestSkip skip = 3; 139 // Stdout from executing the test. 140 string stdout = 4; 141 // Stderr from executing the test. 142 string stderr = 5; 143 // How long this test took to run (in nanoseconds). 144 int64 duration = 6; 145 } 146 147 message TestFailure { 148 string type = 1; 149 string message = 2; 150 string traceback = 3; 151 } 152 153 message TestSkip { 154 string message = 1; 155 } 156 157 message ResourceUsageRequest{ 158 } 159 160 message ResourceUsageResponse{ 161 // Total number of CPUs available to the system. 162 int32 num_cpus = 1; 163 // CPU usage that is measured as "in use", excluding I/O, as a percentage. 164 double cpu_use = 2; 165 // I/O wait, as a percentage of CPU time. 166 double io_wait = 3; 167 // Total amount of memory available 168 uint64 mem_total = 4; 169 // Total amount of memory in use. 170 uint64 mem_used = 5; 171 // Number of inferior worker processes. 172 int32 num_worker_processes = 6; 173 }