go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/bisection/proto/v1/analyses.proto (about)

     1  // Copyright 2023 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.bisection.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/bisection/proto/v1/bugs.proto";
    23  import "go.chromium.org/luci/bisection/proto/v1/common.proto";
    24  import "go.chromium.org/luci/bisection/proto/v1/culprits.proto";
    25  import "go.chromium.org/luci/bisection/proto/v1/heuristic.proto";
    26  import "go.chromium.org/luci/bisection/proto/v1/nthsection.proto";
    27  import "go.chromium.org/luci/buildbucket/proto/common.proto";
    28  import "go.chromium.org/luci/buildbucket/proto/builder_common.proto";
    29  
    30  option go_package = "go.chromium.org/luci/bisection/proto/v1;bisectionpb";
    31  
    32  // Analyses service includes all methods related to failure analyses
    33  // called from LUCI Bisection clients, such as SoM.
    34  service Analyses {
    35    // GetAnalysis is used to get an analysis by analysis ID.
    36    rpc GetAnalysis(GetAnalysisRequest) returns (Analysis);
    37  
    38    // QueryAnalysis is used to query for the status and result of analyses.
    39    // The user can pass in the failure information to retrieve the analyses.
    40    rpc QueryAnalysis(QueryAnalysisRequest) returns (QueryAnalysisResponse);
    41  
    42    // ListAnalyses is used to get existing analyses.
    43    // Most recently created analyses are returned first.
    44    rpc ListAnalyses(ListAnalysesRequest) returns (ListAnalysesResponse);
    45  
    46    // TriggerAnalysis is used to trigger an analysis for a failed build.
    47    // This RPC is called from a LUCI Bisection client like SoM or Milo.
    48    // If an existing analysis is found for the same failure, no new analysis
    49    // will be triggered.
    50    rpc TriggerAnalysis(TriggerAnalysisRequest) returns (TriggerAnalysisResponse);
    51  
    52    // Update the information of an analysis,
    53    // e.g. update the bugs associated with an analysis.
    54    // Mainly used by SoM, since LUCI Bisection does not have any information
    55    // about bugs created by sheriffs.
    56    rpc UpdateAnalysis(UpdateAnalysisRequest) returns (Analysis);
    57  
    58    // ListTestAnalyses is used to get existing test analyses.
    59    // Most recently created test analyses are returned first.
    60    rpc ListTestAnalyses(ListTestAnalysesRequest) returns (ListTestAnalysesResponse);
    61  
    62    // GetTestAnalysis is used to get a test analysis by its ID.
    63    rpc GetTestAnalysis(GetTestAnalysisRequest) returns (TestAnalysis);
    64  
    65    // BatchGetTestAnalyses is an RPC to batch get test analyses for test failures.
    66    // At this moment it only support getting the bisection for the ongoing test failure.
    67    // TODO(@beining): This endpoint can be extended to support returning bisection for
    68    // any test failure by specifying source position in the request.
    69    rpc BatchGetTestAnalyses(BatchGetTestAnalysesRequest) returns (BatchGetTestAnalysesResponse);
    70  
    71  }
    72  
    73  message GetAnalysisRequest {
    74    // ID of the analysis.
    75    int64 analysis_id = 1 [ (google.api.field_behavior) = REQUIRED ];
    76  }
    77  
    78  message QueryAnalysisRequest {
    79    // The build failure information to query for the analyses.
    80    BuildFailure build_failure = 1;
    81  }
    82  
    83  message QueryAnalysisResponse {
    84    // The analyses corresponding to the QueryAnalysisRequest.
    85    repeated Analysis analyses = 1;
    86  }
    87  
    88  message ListAnalysesRequest {
    89    // Optional. The maximum number of analyses to be returned in the response.
    90    // The service may return fewer than this value.
    91    // If unspecified, at most 50 analyses will be returned.
    92    // The maximum value is 200; values above 200 will be coerced to 200.
    93    int32 page_size = 1;
    94    // Optional. A page token, received from a previous `ListAnalyses` call.
    95    // Provide this to retrieve the subsequent page.
    96    // When paginating, all other parameters provided to `ListAnalyses` must
    97    // match the call that provided the page token,
    98    // with the exception of page_size and page_token.
    99    string page_token = 2;
   100  }
   101  
   102  message ListAnalysesResponse {
   103    // The analyses corresponding to the ListAnalysesRequest.
   104    repeated Analysis analyses = 1;
   105    // The token to send as `page_token` to retrieve the next page of analyses.
   106    // If this field is omitted, there are no subsequent pages.
   107    string next_page_token = 2;
   108  }
   109  
   110  message TriggerAnalysisRequest {
   111    // Failure for which to trigger the analysis.
   112    BuildFailure build_failure = 1;
   113    // Optionally, the client can pass the bug associated with the failure.
   114    // LUCI Bisection will update the bug with analysis progress/result.
   115    // This is mainly for SoM, which has information about bugs associated
   116    // with a failure.
   117    repeated BugInfo bug_info = 2;
   118  }
   119  
   120  message TriggerAnalysisResponse {
   121    // The analysis result corresponding to the request.
   122    // It is either a new analysis or an existing one.
   123    Analysis result = 1;
   124    // is_new_analysis will be set to true if a new analysis is triggered.
   125    // It will be set to false if an existing analysis is used instead.
   126    bool is_new_analysis = 2;
   127  }
   128  
   129  // Update the information of an analysis,
   130  // e.g. update the bugs associated with an analysis.
   131  // LUCI Bisection will comment on the bug with analysis progress/results.
   132  // Note: Existing bugs associated with the analysis will be replaced.
   133  message UpdateAnalysisRequest {
   134    // ID of the analysis.
   135    string analysis_id = 1 [ (google.api.field_behavior) = REQUIRED ];
   136    repeated luci.bisection.v1.BugInfo bug_info = 2;
   137  }
   138  
   139  // AnalysisRunStatus focusses on whether the analysis is currently running, not
   140  // the actual result of the analysis.
   141  enum AnalysisRunStatus {
   142    ANALYSIS_RUN_STATUS_UNSPECIFIED = 0;
   143    // The analysis started and is still running.
   144    STARTED = 2;
   145    // The analysis has ended (either it stopped naturally or ran into an error).
   146    ENDED = 3;
   147    // The analysis has been canceled.
   148    CANCELED = 4;
   149  }
   150  
   151  // Analysis contains result of an analysis.
   152  // Next available tag: 15.
   153  message Analysis {
   154    // ID to identify this analysis.
   155    int64 analysis_id = 1;
   156    // The failure associated with the analysis.
   157    BuildFailure build_failure = 2;
   158    // Result status of the analysis.
   159    luci.bisection.v1.AnalysisStatus status = 3;
   160    // Run status of the analysis.
   161    // See https://go.chromium.org/luci/bisection/proto/v1/#AnalysisRunStatus
   162    AnalysisRunStatus run_status = 4;
   163    // Buildbucket ID for the last passed build.
   164    int64 last_passed_bbid = 5;
   165    // Buildbucket ID for the first failed build.
   166    int64 first_failed_bbid = 6;
   167    // Timestamp for the created time of the analysis.
   168    google.protobuf.Timestamp created_time = 7;
   169    // Timestamp for the last updated time of the analysis.
   170    google.protobuf.Timestamp last_updated_time = 8;
   171    // Timestamp for the end time of the analysis.
   172    google.protobuf.Timestamp end_time = 9;
   173    // Result of heuristic analysis.
   174    luci.bisection.v1.HeuristicAnalysisResult heuristic_result = 10;
   175    // Result of nth-section analysis.
   176    luci.bisection.v1.NthSectionAnalysisResult nth_section_result = 11;
   177    // Builder for the first failed build.
   178    buildbucket.v2.BuilderID builder = 12;
   179    // Type of the failure associated with the analysis.
   180    BuildFailureType build_failure_type = 13;
   181    // The culprits for the analysis.
   182    // For some rare cases, we may get more than one culprit for a regression
   183    // range. So we set it as repeated field.
   184    repeated luci.bisection.v1.Culprit culprits = 14;
   185  }
   186  
   187  enum BuildFailureType {
   188    BUILD_FAILURE_TYPE_UNSPECIFIED = 0;
   189    COMPILE = 1;
   190    TEST = 2;
   191    INFRA = 3;
   192    OTHER = 4;
   193  }
   194  
   195  message BuildFailure {
   196    // Buildbucket ID for the failed build.
   197    int64 bbid = 1;
   198    // failed_step_name should be 'compile' for compile failures.
   199    string failed_step_name = 2;
   200  }
   201  
   202  message ListTestAnalysesRequest {
   203    // The project that the test analyses belong to.
   204    string project = 1 [ (google.api.field_behavior) = REQUIRED ];
   205    // Optional. The maximum number of analyses to be returned in the response.
   206    // The service may return fewer than this value.
   207    // If unspecified, at most 50 analyses will be returned.
   208    // The maximum value is 200; values above 200 will be coerced to 200.
   209    int32 page_size = 2;
   210    // Optional. A page token, received from a previous `ListTestAnalyses` call.
   211    // Provide this to retrieve the subsequent page.
   212    // When paginating, all other parameters provided to `ListTestAnalyses` must
   213    // match the call that provided the page token,
   214    // with the exception of page_size and page_token.
   215    string page_token = 3;
   216    // The fields to be included in the response.
   217    // By default, all fields are included.
   218    google.protobuf.FieldMask fields = 4;
   219  }
   220  
   221  message ListTestAnalysesResponse {
   222    // The test analyses corresponding to the ListTestAnalysesRequest.
   223    repeated TestAnalysis analyses = 1;
   224    // The token to send as `page_token` to retrieve the next page of analyses.
   225    // If this field is omitted, there are no subsequent pages.
   226    string next_page_token = 2;
   227  }
   228  
   229  message GetTestAnalysisRequest {
   230    // ID of the analysis.
   231    int64 analysis_id = 1 [ (google.api.field_behavior) = REQUIRED ];
   232    // The fields to be included in the response.
   233    // By default, all fields are included.
   234    google.protobuf.FieldMask fields = 2;
   235  }
   236  
   237  message TestAnalysis {
   238    // ID to identify this analysis.
   239    int64 analysis_id = 1;
   240    // Timestamp for the create time of the analysis.
   241    google.protobuf.Timestamp created_time = 2;
   242    // Timestamp for the start time of the analysis.
   243    google.protobuf.Timestamp start_time = 3;
   244    // Timestamp for the end time of the analysis.
   245    google.protobuf.Timestamp end_time = 4;
   246    // Result status of the analysis.
   247    AnalysisStatus status = 5;
   248    // Run status of the analysis.
   249    AnalysisRunStatus run_status = 6;
   250    // The verified culprit for the analysis.
   251    TestCulprit culprit = 7;
   252    // The builder that the analysis analyzed.
   253    buildbucket.v2.BuilderID builder = 8;
   254    // Test failures that the analysis analyzed.
   255    // The first item will be the primary failure, followed by other failures.
   256    // Bisection process will follow the path of the primary test failure.
   257    repeated TestFailure test_failures = 9;
   258    // The start commit of the regression range (exclusive).
   259    buildbucket.v2.GitilesCommit start_commit = 10;
   260    // The end commit of the regression range (inclusive).
   261    buildbucket.v2.GitilesCommit end_commit = 11;
   262    // The start failure rate of the failures.
   263    float start_failure_rate = 12;
   264    // The end failure rate of the failures.
   265    float end_failure_rate = 13;
   266    // Sample build bucket ID where the primary test failure failed.
   267    int64 sample_bbid = 14;
   268    // Nthsection result.
   269    TestNthSectionAnalysisResult nth_section_result = 15;
   270  }
   271  
   272  message TestFailure {
   273    // The ID of the test.
   274    string test_id = 1;
   275    // The variant hash of the test.
   276    string variant_hash = 2;
   277    // Hash to identify the branch in the source control.
   278    string ref_hash = 3;
   279    // The variant of the test.
   280    Variant variant = 4;
   281    // Whether the test failure was diverged from the primary test failure
   282    // during the bisection process.
   283    bool is_diverged = 5;
   284    // Whether the test failure is a primary failure or not.
   285    bool is_primary = 6;
   286    // Start hour of the test failure.
   287    google.protobuf.Timestamp start_hour = 7;
   288  }
   289  
   290  message TestNthSectionAnalysisResult {
   291    // The status of the nth-section analysis.
   292    AnalysisStatus status = 1;
   293    // The run status of the nth-section analysis.
   294    AnalysisRunStatus run_status = 2;
   295    // Timestamp for the start time of the nth-section analysis.
   296    google.protobuf.Timestamp start_time = 3;
   297    // Timestamp for the end time of the nth-section analysis.
   298    google.protobuf.Timestamp end_time = 4;
   299    // Optional, when status = RUNNING. This is the possible commit range of the
   300    // culprit. This will be updated as the nth-section progress.
   301    // This will only be available if nthsection is still running (not ended).
   302    RegressionRange remaining_nth_section_range = 5;
   303    // List of the reruns that have been run so far for the nth-section analysis.
   304    // The runs are sorted by the create timestamp.
   305    repeated TestSingleRerun reruns = 6;
   306    // The blame list of commits to run the nth-section analysis on.
   307    // The commits are sorted by recency, with the most recent commit first.
   308    BlameList blame_list = 7;
   309    // Optional, when nth-section has found a culprit.
   310    TestCulprit suspect = 8;
   311  }
   312  
   313  message TestSingleRerun {
   314    // Buildbucket ID of the rerun build.
   315    int64 bbid = 1;
   316    // Timestamp for the create time of the rerun.
   317    google.protobuf.Timestamp create_time = 2;
   318    // Timestamp for the start time of the rerun.
   319    google.protobuf.Timestamp start_time = 3;
   320    // Timestamp for the end time of the rerun.
   321    google.protobuf.Timestamp end_time = 4;
   322    // Timestamp when the rerun send the result to bisection from recipe.
   323    google.protobuf.Timestamp report_time = 5;
   324    // ID of the bot that runs the rerun.
   325    string bot_id = 6;
   326    // Result of the rerun.
   327    RerunTestResults rerun_result = 7;
   328    // Gitiles commit to do the rerun with.
   329    buildbucket.v2.GitilesCommit commit = 8;
   330    // Index of the commit to rerun within the blamelist, if this is an
   331    // nth-section rerun. We need to use a string instead of an int here because
   332    // 0 is a possible valid value but would get lost due to the "omitempty" flag
   333    // in the generated proto.
   334    // There is one case where the index is not populated (empty string). It is when
   335    // the culprit is the (last pass + 1) position, and this rerun is for parent commit
   336    // of the culprit verification. In such cases, the parent commit (last pass) is not found in the
   337    // blamelist (this blamelist is (last pass, first fail]). In such case, index will be "".
   338    string index = 9;
   339  }
   340  
   341  message RerunTestResults {
   342    repeated RerunTestSingleResult results = 1;
   343    // Status of the rerun.
   344    RerunStatus rerun_status = 2;
   345  }
   346  
   347  message RerunTestSingleResult {
   348    // Test ID of the result.
   349    string test_id = 1;
   350    // Variant hash of the result.
   351    string variant_hash = 2;
   352    // Number of expected results.
   353    int64 expected_count = 3;
   354    // Number of unexpected results.
   355    int64 unexpected_count = 4;
   356  }
   357  
   358  message TestSuspectVerificationDetails {
   359    // The status of the suspect verification.
   360    SuspectVerificationStatus status = 1;
   361    // The verification rerun build for the suspect commit.
   362    TestSingleRerun suspect_rerun = 2;
   363    // The verification rerun build for the parent commit of the suspect.
   364    TestSingleRerun parent_rerun = 3;
   365  }
   366  
   367  message TestCulprit {
   368    // The gitiles commit for the culprit.
   369    buildbucket.v2.GitilesCommit commit = 1;
   370    // The review URL for the culprit.
   371    string review_url = 2;
   372    // The review title for the culprit.
   373    string review_title = 3;
   374    // Actions we have taken with the culprit.
   375    // More than one action may be taken, for example, reverting the culprit and
   376    // commenting on the bug.
   377    repeated CulpritAction culprit_action = 4;
   378    // The details of suspect verification for the culprit.
   379    TestSuspectVerificationDetails verification_details = 5;
   380  }
   381  
   382  message BatchGetTestAnalysesRequest {
   383    // The LUCI project.
   384    string project = 1;
   385   // Identify a test failure.
   386   message TestFailureIdentifier {
   387     // Identify a test variant. All fields are required.
   388     // This represents the ongoing test failure of this test variant.
   389     string test_id = 1;
   390     string variant_hash = 2;
   391     string ref_hash = 3;
   392     // TODO: Add an optional source_position field in this proto.
   393     // This is the source position where a failure occurs.
   394     // See go/surface-bisection-and-changepoint-analysis-som.
   395   }
   396   // The response will only contain analyses which analyze failures in this list.
   397   // It is an error to request for more than 100 test failures.
   398    repeated TestFailureIdentifier test_failures = 2;
   399  
   400    // The fields to be included in the response.
   401    // By default, all fields are included.
   402    google.protobuf.FieldMask fields = 3;
   403  }
   404  
   405  
   406  message BatchGetTestAnalysesResponse {
   407   // Test analyses for each test failure in the order they were requested.
   408   // The test analysis will be null if the requested test failure has not been
   409   // analyzed by any bisection.
   410   repeated TestAnalysis test_analyses = 1;
   411  }