go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/internal/changepoints/proto/spanner.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.analysis.internal.changepoints;
    18  
    19  import "google/protobuf/timestamp.proto";
    20  
    21  option go_package = "go.chromium.org/luci/analysis/internal/changepoints/proto;changepointspb";
    22  
    23  // Segments is used to store the finalized segments in Spanner.
    24  message Segments {
    25    // Segments, in ascending commit position order (oldest segment first).
    26    repeated Segment segments = 1;
    27  }
    28  
    29  // Segment stores the finalized parts of finalizing and finalized segments
    30  // in Spanner.
    31  // Finalized segments will be stored in full.
    32  // Only the finalized part of a finalizing segment will be stored.
    33  // The unfinalized parts of segments can be computed from the input buffer.
    34  message Segment {
    35    // The state of the segment.
    36    // Only finalizing or finalized segments will be stored in spanner.
    37    SegmentState state = 1;
    38    // If set, means the start of the segment is as a result of a change point
    39    // being identified.
    40    // If unset, means the segment started because this was the first result in
    41    // the known history of the test.
    42    bool has_start_changepoint = 2;
    43    // The earliest commit position included in the segment.
    44    int64 start_position = 3;
    45    // The earliest hour a verdict with the given start_position was recorded.
    46    google.protobuf.Timestamp start_hour = 4;
    47    // The end commit position of the segment.
    48    // If set, the invariant end_position >= start_position holds.
    49    int64 end_position = 5;
    50    // The latest hour a verdict with the last commit position in the segment
    51    // was recorded.
    52    google.protobuf.Timestamp end_hour = 6;
    53    // The lower bound of the change point position at the start of the segment
    54    // in a 99% two-tailed confidence interval. Inclusive.
    55    // Only set if has_start_changepoint is set. If set, the invariant
    56    // previous_segment.start_position <= start_position_lower_bound_99th <= start_position.
    57    int64 start_position_lower_bound_99th = 7;
    58    // The upper bound of the change point position at the start of the segment
    59    // in a 99% two-tailed confidence interval. Inclusive.
    60    // Only set if has_start_changepoint is set. If set, the invariant
    61    // start_position <= start_position_upper_bound_99th <= end_position
    62    // holds.
    63    int64 start_position_upper_bound_99th = 8;
    64    // The hour the most recent verdict with an unexpected test result
    65    // was produced. *Only* captures the most recent hour for verdicts
    66    // that are no longer in the input buffer. Used to set
    67    // has_recent_unexpected_results on the output.
    68    google.protobuf.Timestamp most_recent_unexpected_result_hour = 9;
    69    // Finalized counts for the segment. Note that this should
    70    // *only* capture counts for verdicts that are no longer in
    71    // the input buffer.
    72    // Counts for verdicts in the input buffer can be obtained from the input
    73    // buffer.
    74    Counts finalized_counts = 10;
    75  }
    76  
    77  enum SegmentState {
    78    SEGMENT_STATE_UNSPECIFIED = 0;
    79    // Both the start and end commit positions of the segment are the result
    80    // of analysis on the current input buffer.
    81    ACTIVE = 1;
    82    // The end commit position of the segment is the result of analysis on the
    83    // current input buffer, but the start commit position is the result of
    84    // past analysis.
    85    FINALIZING = 2;
    86    // Both the start and end commit positions of the segment are the result
    87    // of past analysis.
    88    FINALIZED = 3;
    89  }
    90  
    91  // All exclude the effect of skipped test results.
    92  // Next ID: 18
    93  message Counts {
    94    // The number of unexpected non-skipped test results.
    95    int64 unexpected_results = 1;
    96  
    97    // The total number of non-skipped test results.
    98    int64 total_results = 2;
    99  
   100    // The number of expected passed test results.
   101    int64 expected_passed_results = 10;
   102  
   103    // The number of expected failed test results.
   104    int64 expected_failed_results = 11;
   105  
   106    // The number of expected crashed test results.
   107    int64 expected_crashed_results = 12;
   108  
   109    // The number of expected aborted test results.
   110    int64 expected_aborted_results = 13;
   111  
   112    // The number of unexpected passed test results.
   113    int64 unexpected_passed_results = 14;
   114  
   115    // The number of unexpected failed test results.
   116    int64 unexpected_failed_results = 15;
   117  
   118    // The number of unexpected crashed test results.
   119    int64 unexpected_crashed_results = 16;
   120  
   121    // The number of unexpected aborted test results.
   122    int64 unexpected_aborted_results = 17;
   123  
   124    // The number of test runs which had an unexpected test result but were
   125    // not retried.
   126    int64 unexpected_unretried_runs = 3;
   127  
   128    // The number of test run which had an unexpected test result, were
   129    // retried, and still contained only unexpected test results.
   130    int64 unexpected_after_retry_runs = 4;
   131  
   132    // The number of test runs which had an unexpected test result, were
   133    // retried, and eventually recorded an expected test result.
   134    int64 flaky_runs = 5;
   135  
   136    // The total number of test runs.
   137    int64 total_runs = 6;
   138  
   139    // The following verdict statistics exclude the effect of exonerations,
   140    // and skipped test results. Verdicts with only skipped results are not counted
   141    // at all.
   142    // The number of verdicts with only unexpected test results.
   143    int64 unexpected_verdicts = 7;
   144  
   145    // The number of verdicts with a mix of expected and unexpected test results.
   146    int64 flaky_verdicts = 8;
   147  
   148    // The total number of verdicts.
   149    int64 total_verdicts = 9;
   150  }
   151  
   152  // Store statistics about verdicts evicted from the input buffer in Spanner.
   153  //
   154  // Purpose is described in go/luci-analysis-test-variant-analysis-in-clusters.
   155  //
   156  // Statistics about verdicts not yet evicted from the input buffer are not
   157  // stored here because they can be computed directly from the input buffer.
   158  // This means this proto only needs to be updated in Spanner when
   159  // verdicts are evicted from the input buffer (approximately every 1/100
   160  // verdict ingestions), rather than on every verdict ingestion, reducing the
   161  // number of writes required.
   162  message Statistics {
   163    // Statistics by partition time hour. Stored in ascending order (oldest
   164    // hour first).
   165    //
   166    // Retained for 11 days (as 1 + 3 + 7 days):
   167    // - 1 day to support the functional requirement of calculating flakiness
   168    //   using data from up to the last 24 hours.
   169    // - 3 days to account for the fact that some builds may be long-running
   170    //   and could take up to 3 days to complete, so we need flakiness as at
   171    //   a partition time of up to 3 days ago.
   172    // - 7 days to allow time to respond to operational incidents that involve
   173    //   delayed or stuck ingestion tasks, without losing data.
   174    repeated HourBucket hourly_buckets = 1;
   175  
   176    message HourBucket {
   177      // The hour of the verdict's partition time.
   178      // This is the partition time, as the number of seconds since January 1, 1970 UTC
   179      // (i.e. as a unix timestamp), divided by 3600.
   180      int64 hour = 1;
   181  
   182      // The following verdict totals are subject to the ingestion criteria
   183      // for test variant analysis. Broadly speaking, this excludes:
   184      // - data for tryjobs that were not in submitted CV runs,
   185      // - duplicate verdicts (where the same test runs have already been ingested),
   186      // - all skipped test results. If a verdict has only skipped results,
   187      //   it is not ingested. Otherwise, the verdict is ingested minus its
   188      //   skipped results and its status (e.g. expected, flaky or unexpected)
   189      //   is computed based on the remaining non-skipped results.
   190      //
   191      // Lastly, the effect of exoneration is excluded (this means that if a
   192      // flaky verdict is exonerated, it is counted as flaky, and if an
   193      // unexpected verdict is exonerated, it is counted as unexpected).
   194  
   195      // The number of verdicts with only unexpected test results (excluding skips).
   196      int64 unexpected_verdicts = 2;
   197      // The number of verdicts with a mix of expected and unexpected test results
   198      // (excluding skips.)
   199      int64 flaky_verdicts = 3;
   200      // The total number of verdicts.
   201      int64 total_verdicts = 4;
   202    }
   203  }