Documentation ¶
Overview ¶
Package changepoints handles change point detection and analysis. See go/luci-test-variant-analysis-design for details.
It implements two ingestion paths:
- Low latency ingestion: Ingestion for test results that are not testing gerrit changelists. This occurs on the result-ingestion pipeline. It is called low-latency because the result-ingestion pipeline is generally triggered immediately upon invocation finalization.
- High latency ingestion: Ingestion for test results testing gerrit changelists. These results are only eligible for ingestion if the presubmit run suceeded and was submitted. This occurs on the verdict-ingestion pipeline because this is the only pipeline that waits until the LUCI CV run has completed before it ingests. This is known as the high-latency pipeline.
Index ¶
- Constants
- Variables
- func Analyze(ctx context.Context, tvs []*rdbpb.TestVariant, ...) error
- func AnalyzeRun(ctx context.Context, tvs []*rdbpb.RunTestVerdict, opts AnalysisOptions, ...) error
- func ClaimInvocationMutation(project string, invocationID string, rootInvocationID string) *spanner.Mutation
- func CompareTestVariantBranchChangepoint(cpi, cpj *ChangepointDetailRow) bool
- func FetchTestVariantBranches(ctx context.Context) ([]*testvariantbranch.Entry, error)
- func GroupChangepoints(ctx context.Context, rows []*ChangepointDetailRow) [][]*ChangepointDetailRow
- func QueryStatsForClustering(ctx context.Context, tvs []*rdbpb.TestVariant, project string, ...) ([]*clusteringpb.TestVariantBranch, error)
- func StartOfWeek(t time.Time) time.Time
- type AnalysisOptions
- type ChangepointDetailRow
- type ChangepointRow
- type Client
- func (c *Client) Close() error
- func (c *Client) ReadChangepointGroupSummaries(ctx context.Context, opts ReadChangepointGroupSummariesOptions) (groups []*GroupSummary, nextPageToken string, err error)
- func (c *Client) ReadChangepoints(ctx context.Context, project string, week time.Time) (changepoints []*ChangepointDetailRow, err error)
- func (c *Client) ReadChangepointsInGroup(ctx context.Context, opts ReadChangepointsInGroupOptions) (changepoints []*ChangepointRow, err error)
- func (c *Client) ReadChangepointsRealtime(ctx context.Context, week time.Time) (changepoints []*ChangepointDetailRow, err error)
- type Gitiles
- type GroupSummary
- type RateChangeDistribution
- type RateDistribution
- type ReadChangepointGroupSummariesOptions
- type ReadChangepointsInGroupOptions
- type Ref
Constants ¶
const RegressionRangeOverlapPrecThreshold = 0.4
RegressionRangeOverlapPrecThreshold decides whether two changepoints can be grouped together. The regression range overlap percentage is calculated by (# of overlapped commits/# of commits in the narrower regression range).
const TestIDGroupingThreshold = 64
TestIDGroupingThreshold is the threshold to partition changepoints by test ID. TODO: Set this threshold dynamically base on the total number of unique tests in the requested LUCI project and the number of regressions in this period. Because the significance of seeing a gap of 64 in test ID number depends on the above two factors. A possible formula to derive this threshold is (total tests / # of regressions in period) * coefficient.
Variables ¶
var ( RunCounter = metric.NewCounter( "analysis/changepoints/analyze/runs", "The number of runs processed by changepoint analysis, classified by project and status.", nil, field.String("project"), field.String("status"), ) )
Functions ¶
func Analyze ¶
func Analyze(ctx context.Context, tvs []*rdbpb.TestVariant, payload *taskspb.IngestTestVerdicts, sourcesMap map[string]*pb.Sources, exporter *bqexporter.Exporter) error
Analyze performs change point analyses based on incoming test verdicts. sourcesMap contains the information about the source code being tested.
func AnalyzeRun ¶
func AnalyzeRun(ctx context.Context, tvs []*rdbpb.RunTestVerdict, opts AnalysisOptions, exporter *bqexporter.Exporter) error
AnalyzeRun performs change point analyses based on an incoming test run.
func ClaimInvocationMutation ¶
func ClaimInvocationMutation(project string, invocationID string, rootInvocationID string) *spanner.Mutation
ClaimInvocationMutation creates a mutation to claim an invocation for the given root invocation.
func CompareTestVariantBranchChangepoint ¶
func CompareTestVariantBranchChangepoint(cpi, cpj *ChangepointDetailRow) bool
CompareTestVariantBranchChangepoint returns whether element at i is smaller than element at j by comparing TestIDNum, VariantHash, RefHash, NominalStartPosition.
func FetchTestVariantBranches ¶
func FetchTestVariantBranches(ctx context.Context) ([]*testvariantbranch.Entry, error)
func GroupChangepoints ¶
func GroupChangepoints(ctx context.Context, rows []*ChangepointDetailRow) [][]*ChangepointDetailRow
GroupChangepoints returns a 2D array where each row represents a group of changepoints. The grouping result is deterministic, which means same input always results in same groups. The groups are generated with the following steps.
- partition changepoints base on test ID
- For changepoints in each partition, group base on percentage regression range overlap.
func QueryStatsForClustering ¶
func QueryStatsForClustering(ctx context.Context, tvs []*rdbpb.TestVariant, project string, partitionTime time.Time, sourcesMap map[string]*pb.Sources) ([]*clusteringpb.TestVariantBranch, error)
QueryStatsForClustering reads selected statistics for the test variant branch of nominated test verdicts. The statistics are those tracked in the clustered_failures table.
The result slice will contain result items in 1:1 correspondance to the provided test verdicts (i.e. result[i] corresponds to tvs[i]). If no source information is available for some or all of the verdicts, the corresponding item in the response slice will be nil.
Types ¶
type AnalysisOptions ¶
type AnalysisOptions struct { // The LUCI Project the test results should be ingested into. Project string // The ResultDB host from which the invocations are from. ResultDBHost string // The export root under which the test results are being ingested. RootInvocationID string // The invocation being ingested. InvocationID string // The sources tested by tests run in invocation InvocationID, // as viewed from export root RootInvocationID. Sources *pb.Sources // The start of the retention period. PartitionTime time.Time }
type ChangepointDetailRow ¶
type ChangepointDetailRow struct { Project string // TestIDNum is the alphabetical ranking of the test ID in this LUCI project. TestIDNum int64 TestID string VariantHash string Variant bigquery.NullJSON // Point to a branch in the source control. Ref *Ref RefHash string // The source verdict unexpected rate before the changepoint. UnexpectedSourceVerdictRateBefore float64 // The source verdict unexpected rate after the changepoint. UnexpectedSourceVerdictRateAfter float64 // The current source verdict unexpected rate. UnexpectedSourceVerdictRateCurrent float64 // The nominal start hour of the segment after the changepoint. StartHour time.Time LowerBound99th int64 UpperBound99th int64 NominalStartPosition int64 PreviousNominalEndPosition int64 }
ChangepointDetailRow represents a changepoint of a test variant branch with more details including TestIDNum and source verdict rates.
type ChangepointRow ¶
type ChangepointRow struct { Project string TestID string VariantHash string Variant bigquery.NullJSON // Point to a branch in the source control. Ref *Ref RefHash string // The nominal start hour of the segment after the changepoint. StartHour time.Time LowerBound99th int64 UpperBound99th int64 NominalStartPosition int64 PreviousNominalEndPosition int64 }
ChangepointRow represents a changepoint of a test variant branch.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client to read LUCI Analysis changepoints.
func (*Client) ReadChangepointGroupSummaries ¶
func (c *Client) ReadChangepointGroupSummaries(ctx context.Context, opts ReadChangepointGroupSummariesOptions) (groups []*GroupSummary, nextPageToken string, err error)
ReadChangepointGroupSummaries reads summaries of changepoint groups started at a week which is within the last 90 days.
func (*Client) ReadChangepoints ¶
func (c *Client) ReadChangepoints(ctx context.Context, project string, week time.Time) (changepoints []*ChangepointDetailRow, err error)
ReadChangepoints reads changepoints of a certain week from BigQuery. The week parameter can be at any time of that week. A week is defined by Sunday to Satureday in UTC.
func (*Client) ReadChangepointsInGroup ¶
func (c *Client) ReadChangepointsInGroup(ctx context.Context, opts ReadChangepointsInGroupOptions) (changepoints []*ChangepointRow, err error)
ReadChangepointsInGroup read changepoints in the same group as the changepoint specified in option. At most 1000 changepoints are returned, ordered by NominalStartPosition DESC, TestID, VariantHash, RefHash.
func (*Client) ReadChangepointsRealtime ¶
func (c *Client) ReadChangepointsRealtime(ctx context.Context, week time.Time) (changepoints []*ChangepointDetailRow, err error)
ReadChangepointsRealtime reads changepoints of a certain week directly from BigQuery exports of changepoint analysis. A week in this context refers to the period from Sunday at 00:00:00 AM UTC (inclusive) to the following Sunday at 00:00:00 AM UTC (exclusive). The week parameter MUST be a timestamp representing the start of a week (Sunday at 00:00:00 AM UTC) and within the last 90 days.
type Gitiles ¶
type Gitiles struct { Host bigquery.NullString Project bigquery.NullString Ref bigquery.NullString }
type GroupSummary ¶
type GroupSummary struct { CanonicalChangepoint ChangepointRow Total int64 UnexpectedSourceVerdictRateBefore RateDistribution UnexpectedSourceVerdictRateAfter RateDistribution UnexpectedSourceVerdictRateCurrent RateDistribution UnexpectedSourveVerdictRateChange RateChangeDistribution }
type RateChangeDistribution ¶
type RateDistribution ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package analyzer converts the input buffer into segments using changepoint analysis, and synthesises those segments with the segments in the output buffer to produce a logical segementation of the test history.
|
Package analyzer converts the input buffer into segments using changepoint analysis, and synthesises those segments with the segments in the output buffer to produce a logical segementation of the test history. |
Package bayesian implements bayesian analysis for detecting change points.
|
Package bayesian implements bayesian analysis for detecting change points. |
Package bqexporter handles the export of test variant analysis results to BigQuery.
|
Package bqexporter handles the export of test variant analysis results to BigQuery. |
Package bqupdator handles the update of bigquery tables related to changepoint analysis.
|
Package bqupdator handles the update of bigquery tables related to changepoint analysis. |
Package groupexporter provides functions to export grouped changepoints to BigQuery.
|
Package groupexporter provides functions to export grouped changepoints to BigQuery. |
Package groupscheduler schedules group changepoints tasks.
|
Package groupscheduler schedules group changepoints tasks. |
Package inputbuffer handles the input buffer of change point analysis.
|
Package inputbuffer handles the input buffer of change point analysis. |
Package model contains common types used in changepoint analysis.
|
Package model contains common types used in changepoint analysis. |
Package sorbet implements analysis for test changepoint culprits.
|
Package sorbet implements analysis for test changepoint culprits. |
Package sources handles sources information.
|
Package sources handles sources information. |
Package testutil contains utility functions for tests.
|
Package testutil contains utility functions for tests. |
Package testvariantbranch handles test variant branch of change point analysis.
|
Package testvariantbranch handles test variant branch of change point analysis. |