go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/proto/v1/rules.proto (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package luci.analysis.v1; 18 19 import "google/api/field_behavior.proto"; 20 import "google/protobuf/field_mask.proto"; 21 import "google/protobuf/timestamp.proto"; 22 import "go.chromium.org/luci/analysis/proto/v1/common.proto"; 23 24 option go_package = "go.chromium.org/luci/analysis/proto/v1;analysispb"; 25 26 // Provides methods to manipulate rules in LUCI Analysis, used to associate 27 // failures with bugs. 28 service Rules { 29 // Retrieves a rule. 30 // Designed to conform to https://google.aip.dev/131. 31 rpc Get(GetRuleRequest) returns (Rule) {}; 32 33 // Lists rules. 34 // TODO: implement pagination to make this 35 // RPC compliant with https://google.aip.dev/132. 36 // This RPC is incomplete. Future breaking changes are 37 // expressly flagged. 38 rpc List(ListRulesRequest) returns (ListRulesResponse) {}; 39 40 // Creates a new rule. 41 // Designed to conform to https://google.aip.dev/133. 42 rpc Create(CreateRuleRequest) returns (Rule) {}; 43 44 // Updates a rule. 45 // Designed to conform to https://google.aip.dev/134. 46 rpc Update(UpdateRuleRequest) returns (Rule) {}; 47 48 // Looks up the rule associated with a given bug, without knowledge 49 // of the LUCI project the rule is in. 50 // Designed to conform to https://google.aip.dev/136. 51 rpc LookupBug(LookupBugRequest) returns (LookupBugResponse) {}; 52 } 53 54 // A rule associating failures with a bug. 55 message Rule { 56 // The resource name of the failure association rule. 57 // Can be used to refer to this rule, e.g. in Rules.Get RPC. 58 // Format: projects/{project}/rules/{rule_id}. 59 // See also https://google.aip.dev/122. 60 string name = 1; 61 62 // The LUCI Project for which this rule is defined. 63 string project = 2 64 [(google.api.field_behavior) = OUTPUT_ONLY]; 65 66 // The unique identifier for the failure association rule, 67 // as 32 lowercase hexadecimal characters. 68 string rule_id = 3 69 [(google.api.field_behavior) = OUTPUT_ONLY]; 70 71 // The rule predicate, defining which failures are being associated. 72 // For example, 'reason LIKE "Some error: %"'. 73 // 74 // analysis/internal/clustering/rules/lang/lang.go contains the 75 // EBNF grammar for the language used to define rule predicates; 76 // it is a subset of Google Standard SQL. 77 // 78 // The maximum allowed length is 65536 characters. 79 string rule_definition = 4 80 [(google.api.field_behavior) = REQUIRED]; 81 82 // The bug that the failures are associated with. 83 luci.analysis.v1.AssociatedBug bug = 5 84 [(google.api.field_behavior) = REQUIRED]; 85 86 // Whether the bug should be updated by LUCI Analysis, and whether 87 // failures should still be matched against the rule. 88 bool is_active = 6; 89 90 // Whether LUCI Analysis should manage the priority and verified status 91 // of the associated bug based on the impact established via this rule. 92 bool is_managing_bug = 14; 93 94 // Determines whether LUCI Analysis is managing the bug priority updates 95 // of the bug. 96 bool is_managing_bug_priority = 15; 97 98 // Output Only. The time is_managing_bug_priority was last updated. 99 google.protobuf.Timestamp is_managing_bug_priority_last_update_time = 16; 100 101 // The suggested cluster this rule was created from (if any). 102 // Until re-clustering is complete and has reduced the residual impact 103 // of the source cluster, this cluster ID tells bug filing to ignore 104 // the source cluster when determining whether new bugs need to be filed. 105 // Immutable after creation. 106 luci.analysis.v1.ClusterId source_cluster = 7; 107 108 // Bug management state. 109 // System controlled data, cannot be modified by the user. 110 BugManagementState bug_management_state = 17 111 [(google.api.field_behavior) = OUTPUT_ONLY]; 112 113 // The time the rule was created. 114 google.protobuf.Timestamp create_time = 8 115 [(google.api.field_behavior) = OUTPUT_ONLY]; 116 117 // The user which created the rule. 118 // This could be an email address or the value 'system' (for rules 119 // automaticatically created by LUCI Analysis itself). 120 // This value may not be available, as its disclosure is limited 121 // to Googlers only and is subject to automatic deletion after 30 days. 122 string create_user = 9 123 [(google.api.field_behavior) = OUTPUT_ONLY]; 124 125 // The last time an auditable field was updated. An auditable field 126 // is any field other than a system controlled data field. 127 google.protobuf.Timestamp last_auditable_update_time = 18 128 [(google.api.field_behavior) = OUTPUT_ONLY]; 129 130 // The last user which updated an auditable field. An auditable field 131 // is any field other than a system controlled data field. 132 // This could be an email address or the value 'system' (for rules 133 // automaticatically modified by LUCI Analysis itself). 134 // This value may not be available, as its disclosure is limited 135 // to Googlers only and is subject to automatic deletion after 30 days. 136 string last_auditable_update_user = 19 137 [(google.api.field_behavior) = OUTPUT_ONLY]; 138 139 // The time the rule was last updated. 140 google.protobuf.Timestamp last_update_time = 10 141 [(google.api.field_behavior) = OUTPUT_ONLY]; 142 143 reserved 11; // Removed. 144 145 // The time the rule was last updated in a way that caused the 146 // matched failures to change, i.e. because of a change to rule_definition 147 // or is_active. (By contrast, updating the associated bug does NOT change 148 // the matched failures, so does NOT update this field.) 149 // Output only. 150 google.protobuf.Timestamp predicate_last_update_time = 13 151 [(google.api.field_behavior) = OUTPUT_ONLY]; 152 153 // This checksum is computed by the server based on the value of other 154 // fields, and may be sent on update requests to ensure the client 155 // has an up-to-date value before proceeding. 156 // See also https://google.aip.dev/154. 157 string etag = 12; 158 159 // Next ID: 20 160 } 161 162 // BugManagementState is the state of bug management for a rule. 163 message BugManagementState { 164 // The state of each bug management policy. 165 repeated PolicyState policy_state = 1; 166 167 // The state of a bug management policy for a rule. 168 message PolicyState { 169 // The identifier of the bug management policy. 170 string policy_id = 1; 171 172 // Whether the given policy is active for the rule. 173 // Updated on every bug-filing run as follows: 174 // - Set to true if the policy activation criteria was met. 175 // - Set to false if the policy deactivation criteria was met. 176 bool is_active = 2; 177 178 // The last time the policy was made active. 179 // Allows detecting if policy is made active for the first time (as a 180 // zero last_activation_time indicates the policy was never active). 181 // Allows UI to filter to showing policies that were at least once active. 182 // Allows UI to sort which policy was most recently active. 183 // Allows UI to show when a policy last activated. 184 google.protobuf.Timestamp last_activation_time = 3; 185 186 // The last time the policy was made inactive. 187 // Allows UI to show when a policy last deactivated. 188 google.protobuf.Timestamp last_deactivation_time = 4; 189 } 190 } 191 192 message GetRuleRequest { 193 // The name of the rule to retrieve. 194 // Format: projects/{project}/rules/{rule_id}. 195 string name = 1 196 [(google.api.field_behavior) = REQUIRED]; 197 } 198 199 message ListRulesRequest { 200 // The parent, which owns this collection of rules. 201 // Format: projects/{project}. 202 string parent = 1 203 [(google.api.field_behavior) = REQUIRED]; 204 } 205 206 message ListRulesResponse { 207 // The rules. 208 repeated Rule rules = 1; 209 } 210 211 message CreateRuleRequest { 212 // The parent resource where the rule will be created. 213 // Format: projects/{project}. 214 string parent = 1 215 [(google.api.field_behavior) = REQUIRED]; 216 217 // The rule to create. 218 Rule rule = 2 219 [(google.api.field_behavior) = REQUIRED]; 220 } 221 222 message UpdateRuleRequest { 223 // The rule to update. 224 // 225 // The rule's `name` field is used to identify the book to update. 226 // Format: projects/{project}/rules/{rule_id}. 227 Rule rule = 1 228 [(google.api.field_behavior) = REQUIRED]; 229 230 // The list of fields to update. 231 google.protobuf.FieldMask update_mask = 2; 232 233 // The current etag of the rule. 234 // If an etag is provided and does not match the current etag of the rule, 235 // update will be blocked and an ABORTED error will be returned. 236 string etag = 3; 237 } 238 239 message LookupBugRequest { 240 // System is the bug tracking system of the bug. This is either 241 // "monorail" or "buganizer". 242 string system = 1 243 [(google.api.field_behavior) = REQUIRED]; 244 245 // Id is the bug tracking system-specific identity of the bug. 246 // For monorail, the scheme is {project}/{numeric_id}, for 247 // buganizer the scheme is {numeric_id}. 248 string id = 2 249 [(google.api.field_behavior) = REQUIRED]; 250 } 251 252 message LookupBugResponse { 253 // The rules corresponding to the requested bug. 254 // Format: projects/{project}/rules/{rule_id}. 255 repeated string rules = 2; 256 }