go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/proto/v1/changepoints.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.analysis.v1;
    18  
    19  option go_package = "go.chromium.org/luci/analysis/proto/v1;analysispb";
    20  
    21  import "google/protobuf/timestamp.proto";
    22  import "go.chromium.org/luci/analysis/proto/v1/sources.proto";
    23  import "go.chromium.org/luci/analysis/proto/v1/common.proto";
    24  
    25  // This service currently only return changepoints which have an increase in unexpected verdict rate, aka. Regression.
    26  // In the future, it may be extended for obtaining groups which have a decreased unexpected verdict rate aka. fixes.
    27  service Changepoints {
    28    // Query the changepoint group summaries.
    29    // Currently this RPC only returns at most 1000 changepoint groups starting at the current week.
    30    // TODO: Add pagination to this RPC so that more changepoint history can be seen.
    31    rpc QueryChangepointGroupSummaries(QueryChangepointGroupSummariesRequest) returns (
    32      QueryChangepointGroupSummariesResponse) {};
    33    // Query the changepoints in a particular group.
    34    // TODO: Implement pagination, currently just return at most 1000 changepoints.
    35    rpc QueryChangepointsInGroup(QueryChangepointsInGroupRequest) returns (
    36      QueryChangepointsInGroupResponse) {}
    37  }
    38  
    39  message QueryChangepointGroupSummariesRequest {
    40    // The LUCI project. Mandatory field.
    41    string project = 1;
    42    // A filter to be applied to each changepoint in the groups.
    43    // If all changepoints in a group are filtered out, this group will not be returned.
    44    ChangepointPredicate predicate = 2;
    45  }
    46  
    47  // Represent a function Changepoint -> bool
    48  message ChangepointPredicate {
    49    // The test id of this changepoint matches this prefix.
    50    string test_id_prefix = 1;
    51  
    52    // Specify a range. The unexpected verdict rate change on this changepoint needs to fall into this range.
    53    // Unexpected verdict rate change is calculated by (unexpected verdict rate after changepoint - unexpected verdict rate before changepoint). Negative number means unexpected verdict rate decreases, positive number means increases.
    54    // eg. {lower_bound:0.1, upper_bound:0.9} means keep changepoint which has a unexpected verdict rate increase >= 10% and <= 90%.
    55    NumericRange unexpected_verdict_rate_change_range = 2;
    56  }
    57  
    58  message QueryChangepointGroupSummariesResponse {
    59    // A list of changepoint group summaries.
    60    repeated ChangepointGroupSummary group_summaries = 1;
    61  }
    62  
    63  // Represent the summary of a changepoint group.
    64  message ChangepointGroupSummary {
    65    // The canonical changepoint in the group. This is the changepoint with minimum (test_id, variant_hash, ref_hash, nominal_start_position) combination.
    66    Changepoint canonical_changepoint = 1;
    67    // Statistics of this group.
    68    ChangepointGroupStatistics statistics = 2;
    69  }
    70  
    71  message ChangepointGroupStatistics {
    72    // The number of test variant branches in this group.
    73    int32 count = 1;
    74    message RateDistribution {
    75      // Average unexpected verdict rate of all test variant branches in the group. This is a value between 0.0 and 1.0.
    76      // Consequently, this is an ‘average of averages’.
    77      float average = 1;
    78      message RateBuckets {
    79        // Counts the number of test variant branches with a unexpected verdict rate less than 5% (exclusive).
    80        int32 count_less_5_percent = 1;
    81        // Counts the number of test variant branches with a unexpected verdict rate greater than or equal to 5%, but less than 95%.
    82        int32 count_above_5_less_than_95_percent = 2;
    83        // Counts the number of test variant branches with a unexpected verdict rate equal to or greater than 95%.
    84        int32 count_above_95_percent = 3;
    85      }
    86      // Count the number of changepoint that fall into each rate bucket.
    87      RateBuckets buckets = 2;
    88    }
    89  
    90    // Unexpected verdict rate before the changepoint.
    91    // The per test variant branch, unexpected verdict rate is calculated as (count of unexpected verdict/count of all verdicts).
    92    RateDistribution unexpected_verdict_rate_before = 2;
    93    // Unexpected verdict rate after the changepoint.
    94    RateDistribution unexpected_verdict_rate_after = 3;
    95    // The current unexpected verdict rate.
    96    RateDistribution unexpected_verdict_rate_current = 4;
    97  
    98    // Unexpected verdict rate change is calculated by (unexpected verdict rate after changepoint - unexpected verdict rate before changepoint).
    99    // TODO: we need to add buckets for unexpected verdict rate decrease when we support grouping fixes. Unexpected verdict rate decrease will be represented as negative number.
   100    message RateChangeBuckets {
   101      // Counts the number of test variant branches which saw their unexpected verdict rate increase by between 0% (inclusive) and 20% (exclusive).
   102      int32 count_increased_0_to_20_percent = 1;
   103      // Counts the number of test variant branches which saw their unexpected verdict rate increase by between 20% (inclusive) and 50% (exclusive).
   104      int32 count_increased_20_to_50_percent = 2;
   105      // Counts the number of test variant branches which saw their unexpected verdict rate increase by between 50% (inclusive) or more.
   106      int32 count_increased_50_to_100_percent = 3;
   107    }
   108    // The amount of change in unexpected verdict rate before and after the changepoint.
   109    RateChangeBuckets unexpected_verdict_rate_change = 5;
   110  }
   111  
   112  message QueryChangepointsInGroupRequest {
   113    // The LUCI project. Mandatory field.
   114    string project = 1;
   115    // We consider two changepoints matches if
   116    //   * their test_id, variant_hash, ref_hash are exactly the same,
   117    //           AND
   118    //   *  nominal_start_position is within the other changepoint's 99% confidence interval (inclusive).
   119    // Most of the time there should be only one matching changepoint.
   120    // However, in rare cases adjacent segments can have an overlapping 99% confidence interval.
   121    // It makes it possible that more than one changepoint matches. In this case, we select the one with the closest nominal start position.
   122    message ChangepointIdentifier {
   123      string test_id = 1;
   124      string variant_hash = 2;
   125      string ref_hash = 3;
   126      int64 nominal_start_position = 4;
   127      // The nominal start hour of this changepoint in UTC.
   128      // This is used to locate a week in UTC (Saturday to Sunday) to generate changepoint groups.
   129      google.protobuf.Timestamp start_hour = 5;
   130    }
   131  
   132    // Identify a group with this changepoint. Mandatory field.
   133    ChangepointIdentifier group_key = 2;
   134    // A filter to be applied to each changepoint.
   135    ChangepointPredicate predicate = 3;
   136  }
   137  
   138  // TODO: Implement pagination, currently just return at most 1000 changepoints.
   139  message QueryChangepointsInGroupResponse {
   140    // A list of changepoints in a group.
   141    repeated Changepoint changepoints = 1;
   142  }
   143  
   144  
   145  // Represent a changepoint of a test variant branch.
   146  // Next ID: 15.
   147  message Changepoint {
   148    // The LUCI Project. E.g. "chromium".
   149    string project = 1;
   150    // The identity of the test.
   151    string test_id = 2;
   152    // Hash of the variant, as 16 lowercase hexadecimal characters.
   153    // E.g. "96c68dc946ab4068".
   154    string variant_hash = 3;
   155    // key:value pairs to specify the way of running a particular test.
   156    // e.g. a specific bucket, builder and a test suite.
   157    luci.analysis.v1.Variant variant = 14;
   158    // Hash of the source branch, as 16 lowercase hexadecimal characters.
   159    string ref_hash = 4;
   160    // The branch in source control.
   161    luci.analysis.v1.SourceRef ref = 5;
   162    // The nominal start hour of this changepoint.
   163    google.protobuf.Timestamp start_hour = 9;
   164    // The lower bound of the starting changepoint position in a 99% two-tailed
   165    // confidence interval. Inclusive.
   166    int64 start_position_lower_bound_99th = 10;
   167    // The upper bound of the starting changepoint position in a 99% two-tailed
   168    // confidence interval. Inclusive.
   169    int64 start_position_upper_bound_99th = 11;
   170    // The nominal commit position at which the segment starts (inclusive).
   171    int64 nominal_start_position = 12;
   172    // The nominal commit position at which the previous segment ends (inclusive).
   173    int64 previous_segment_nominal_end_position = 13;
   174  }