go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/proto/v1/test_history.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/duration.proto";
    21  import "google/protobuf/timestamp.proto";
    22  import "go.chromium.org/luci/analysis/proto/v1/common.proto";
    23  import "go.chromium.org/luci/analysis/proto/v1/predicate.proto";
    24  import "go.chromium.org/luci/analysis/proto/v1/test_verdict.proto";
    25  
    26  option go_package = "go.chromium.org/luci/analysis/proto/v1;analysispb";
    27  
    28  // Provide methods to read test histories.
    29  service TestHistory {
    30    // Retrieves test verdicts for a given test ID in a given project and in a
    31    // given range of time.
    32    // Accepts a test variant predicate to filter the verdicts.
    33    rpc Query(QueryTestHistoryRequest) returns (
    34      QueryTestHistoryResponse) {};
    35  
    36    // Retrieves a summary of test verdicts for a given test ID in a given project
    37    // and in a given range of times.
    38    // Accepts a test variant predicate to filter the verdicts.
    39    rpc QueryStats(QueryTestHistoryStatsRequest) returns (
    40      QueryTestHistoryStatsResponse) {};
    41  
    42    // Retrieves variants for a given test ID in a given project that were
    43    // recorded in the past 90 days.
    44    rpc QueryVariants(QueryVariantsRequest) returns (QueryVariantsResponse) {};
    45  
    46    // Finds test IDs that contain the given substring in a given project that
    47    // were recorded in the past 90 days.
    48    rpc QueryTests(QueryTestsRequest) returns (QueryTestsResponse) {};
    49  }
    50  
    51  // A request message for `TestHistory.Query` RPC.
    52  message QueryTestHistoryRequest {
    53    // Required. The LUCI Project of the test results.
    54    // I.e. For a result to be part of the history, it needs to be contained
    55    // transitively by an invocation in this project.
    56    string project = 1
    57      [(google.api.field_behavior) = REQUIRED];
    58  
    59    // Required. The test ID to query the history from.
    60    string test_id = 2
    61      [(google.api.field_behavior) = REQUIRED];
    62  
    63    // Required. A test verdict in the response must satisfy this predicate.
    64    luci.analysis.v1.TestVerdictPredicate predicate = 3
    65      [(google.api.field_behavior) = REQUIRED];
    66  
    67    // The maximum number of entries to return.
    68    //
    69    // The service may return fewer than this value.
    70    // If unspecified, at most 100 variants will be returned.
    71    // The maximum value is 1000; values above 1000 will be coerced to 1000.
    72    int32 page_size = 4;
    73  
    74    // A page token, received from a previous call.
    75    // Provide this to retrieve the subsequent page.
    76    //
    77    // When paginating, all other parameters provided to the next call MUST
    78    // match the call that provided the page token.
    79    string page_token = 5;
    80  }
    81  
    82  // A response message for `TestHistory.Query` RPC.
    83  message QueryTestHistoryResponse {
    84    // The list of test verdicts.
    85    // Test verdicts will be ordered by `partition_time` DESC, `variant_hash` ASC,
    86    // `invocation_id` ASC.
    87    repeated luci.analysis.v1.TestVerdict verdicts = 1;
    88  
    89    // This field will be set if there are more results to return.
    90    // To get the next page of data, send the same request again, but include this
    91    // token.
    92    string next_page_token = 2;
    93  }
    94  
    95  // A request message for `TestHistory.QueryStats` RPC.
    96  message QueryTestHistoryStatsRequest {
    97    // Required. The LUCI Project of the test results.
    98    // I.e. For a result to be part of the history, it needs to be contained
    99    // transitively by an invocation in this project.
   100    string project = 1
   101      [(google.api.field_behavior) = REQUIRED];
   102  
   103    // Required. The test ID to query the history from.
   104    string test_id = 2
   105      [(google.api.field_behavior) = REQUIRED];
   106  
   107    // Required. A test verdict in the response must satisfy this predicate.
   108    luci.analysis.v1.TestVerdictPredicate predicate = 3
   109      [(google.api.field_behavior) = REQUIRED];
   110  
   111    // The maximum number of entries to return.
   112    //
   113    // The service may return fewer than this value.
   114    // If unspecified, at most 100 variants will be returned.
   115    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   116    int32 page_size = 4;
   117  
   118    // A page token, received from a previous call.
   119    // Provide this to retrieve the subsequent page.
   120    //
   121    // When paginating, all other parameters provided to the next call
   122    // MUST match the call that provided the page token.
   123    string page_token = 5;
   124  }
   125  
   126  // A response message for `TestHistory.QueryStats` RPC.
   127  message QueryTestHistoryStatsResponse {
   128    message Group {
   129      // The start time of this group.
   130      // Test verdicts that are paritioned in the 24 hours following this
   131      // timestamp are captured in this group.
   132      google.protobuf.Timestamp partition_time = 1;
   133  
   134      // The hash of the variant.
   135      string variant_hash = 2;
   136  
   137      // The number of unexpected test verdicts in the group.
   138      int32 unexpected_count = 3;
   139  
   140      // The number of unexpectedly skipped test verdicts in the group.
   141      int32 unexpectedly_skipped_count = 4;
   142  
   143      // The number of flaky test verdicts in the group.
   144      int32 flaky_count = 5;
   145  
   146      // The number of exonerated test verdicts in the group.
   147      int32 exonerated_count = 6;
   148  
   149      // The number of expected test verdicts in the group.
   150      int32 expected_count = 7;
   151  
   152      // The average duration of passing test results in the group.
   153      google.protobuf.Duration passed_avg_duration = 8;
   154    }
   155  
   156    // The list of test verdict groups. Test verdicts will be grouped and ordered
   157    // by `partition_date` DESC, `variant_hash` ASC.
   158    repeated Group groups = 1;
   159  
   160    // This field will be set if there are more results to return.
   161    // To get the next page of data, send the same request again, but include this
   162    // token.
   163    string next_page_token = 2;
   164  }
   165  
   166  // A request message for the `QueryVariants` RPC.
   167  message QueryVariantsRequest {
   168    // Required. The LUCI project to query the variants from.
   169    string project = 1
   170      [(google.api.field_behavior) = REQUIRED];
   171  
   172    // Required. The test ID to query the variants from.
   173    string test_id = 2
   174      [(google.api.field_behavior) = REQUIRED];
   175  
   176    // Optional. The project-scoped realm to query the variants from.
   177    // This is the realm without the "<project>:" prefix.
   178    //
   179    // When specified, only the test variants found in the matching realm will be
   180    // returned.
   181    string sub_realm = 3;
   182  
   183    // Optional. When specified, only variant matches this predicate will be
   184    // returned.
   185    VariantPredicate variant_predicate = 6;
   186  
   187    // The maximum number of variants to return.
   188    //
   189    // The service may return fewer than this value.
   190    // If unspecified, at most 100 variants will be returned.
   191    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   192    int32 page_size = 4;
   193  
   194    // A page token, received from a previous `QueryVariants` call.
   195    // Provide this to retrieve the subsequent page.
   196    //
   197    // When paginating, all other parameters provided to `QueryVariants` MUST
   198    // match the call that provided the page token.
   199    string page_token = 5;
   200  }
   201  
   202  // A response message for the `QueryVariants` RPC.
   203  message QueryVariantsResponse {
   204    // Contains the variant definition and its hash.
   205    message VariantInfo {
   206      // The hash of the variant.
   207      string variant_hash = 1;
   208  
   209      // The definition of the variant.
   210      luci.analysis.v1.Variant variant = 2;
   211    }
   212  
   213    // A list of variants. Ordered by variant hash.
   214    repeated VariantInfo variants = 1;
   215  
   216    // A token, which can be sent as `page_token` to retrieve the next page.
   217    // If this field is omitted, there were no subsequent pages at the time of
   218    // request.
   219    string next_page_token = 2;
   220  }
   221  
   222  // A request message for the `QueryTests` RPC.
   223  message QueryTestsRequest {
   224    // Required. The LUCI project to query the tests from.
   225    string project = 1
   226      [(google.api.field_behavior) = REQUIRED];
   227  
   228    // Required. Only tests that contain the substring will be returned.
   229    string test_id_substring = 2
   230      [(google.api.field_behavior) = REQUIRED];
   231  
   232    // Optional. The project-scoped realm to query the variants from.
   233    // This is the realm without the "<project>:" prefix.
   234    //
   235    // When specified, only the tests found in the matching realm will be
   236    // returned.
   237    string sub_realm = 3;
   238  
   239    // The maximum number of test IDs to return.
   240    //
   241    // The service may return fewer than this value.
   242    // If unspecified, at most 100 test IDs will be returned.
   243    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   244    int32 page_size = 4;
   245  
   246    // A page token, received from a previous `QueryTests` call.
   247    // Provide this to retrieve the subsequent page.
   248    //
   249    // When paginating, all other parameters provided to `QueryTests` MUST
   250    // match the call that provided the page token.
   251    string page_token = 5;
   252  }
   253  
   254  // A response message for the `QueryTests` RPC.
   255  message QueryTestsResponse {
   256    // A list of test Ids. Ordered alphabetically.
   257    repeated string test_ids = 1;
   258  
   259    // A token, which can be sent as `page_token` to retrieve the next page.
   260    // If this field is omitted, there were no subsequent pages at the time of
   261    // request.
   262    string next_page_token = 2;
   263  }