go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/luci_notify/api/service/v1/alerts.proto (about)

     1  // Copyright 2024 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.notify.v1;
    18  
    19  import "google/api/field_behavior.proto";
    20  import "google/protobuf/timestamp.proto";
    21  
    22  option go_package = "go.chromium.org/luci/luci_notify/api/service/v1;lucinotifypb";
    23  
    24  // Service Alerts exposes alerts used in on-call monitoring tools.
    25  // For now it only tracks mutable fields, with alerts being generated
    26  // by Sheriff-o-Matic, but eventually the alerts available through this
    27  // service will incorporate all of the needed information.
    28  service Alerts {
    29    // BatchGetAlerts allows getting a number of alerts by resource name.
    30    // If no alert exists by the given name an empty alert will be returned.
    31    rpc BatchGetAlerts(BatchGetAlertsRequest) returns (BatchGetAlertsResponse) {};
    32  
    33    // BatchUpdateAlerts allows updating the mutable data on a batch of alerts.
    34    rpc BatchUpdateAlerts(BatchUpdateAlertsRequest) returns (BatchUpdateAlertsResponse) {};
    35  }
    36  
    37  message BatchGetAlertsRequest {
    38    // The resource names of the alerts to get.
    39    //
    40    // Currently by convention the keys match the keys in sheriff-o-matic, but
    41    // this is not a requirement.
    42    //
    43    // Format: alerts/{key}
    44    repeated string names = 1;
    45  }
    46  
    47  // The Status of a tree for an interval of time.
    48  message Alert {
    49    // The resource name of this alert.
    50    // Format: alerts/{key}
    51    string name = 1 [
    52      (google.api.field_behavior) = OUTPUT_ONLY,
    53      (google.api.field_behavior) = IMMUTABLE
    54    ];
    55    // The buganizer bug ID of the bug associated with this alert.
    56    // 0 means the alert is not associated with any bug.
    57    int64 bug = 3;
    58    // The build number of the builder corresponding to the alert that this alert should be ignored until.
    59    // In other words, if the latest_failing_build_number (currently in SOM alerts) <= silence_until, this alert should be considered 'silenced'.
    60    int64 silence_until = 4;
    61    // The time the alert was last modified.
    62    //
    63    // This is automatically set by the server and cannot be modified explicitly
    64    // through RPC.
    65    google.protobuf.Timestamp modify_time = 5
    66        [(google.api.field_behavior) = OUTPUT_ONLY];
    67  
    68    // This checksum is computed by the server based on the value of other
    69    // fields, and may be sent on update and delete requests to ensure the
    70    // client has an up-to-date value before proceeding.
    71    // Note that these etags are weak - they are only computed based on mutable
    72    // fields.  Other fields in the alert may be auto-updated but they will not
    73    // affect the etag value.
    74    // The etag field is optional on update requests, if not provided
    75    // the update will succeed.  If provided, the update will only succeed if
    76    // the etag is an exact match.
    77    string etag = 6;
    78  }
    79  
    80  message BatchGetAlertsResponse {
    81    // Alerts requested.
    82    // The order matches the order of names in the request.
    83    repeated Alert alerts = 1;
    84  }
    85  
    86  message UpdateAlertRequest {
    87    // The alert to update.
    88    Alert alert = 1;
    89  }
    90  
    91  message BatchUpdateAlertsRequest {
    92    // The request messages specifying the alerts to update.
    93    // A maximum of 1000 alerts can be modified in a batch.
    94    repeated UpdateAlertRequest requests = 1;
    95  }
    96  
    97  message BatchUpdateAlertsResponse {
    98    // Alerts updated.
    99    // The order matches the order of names in the request.
   100    repeated Alert alerts = 1;
   101  }