Documentation ¶
Overview ¶
Package changepoints handles change point detection and analysis. See go/luci-test-variant-analysis-design for details.
Index ¶
- Constants
- func Analyze(ctx context.Context, tvs []*rdbpb.TestVariant, ...) error
- func CompareTestVariantBranchChangepoint(cpi, cpj *ChangepointRow) bool
- func FetchTestVariantBranches(ctx context.Context) ([]*testvariantbranch.Entry, error)
- func GroupChangepoints(rows []*ChangepointRow) [][]*ChangepointRow
- func QueryStatsForClustering(ctx context.Context, tvs []*rdbpb.TestVariant, project string, ...) ([]*clusteringpb.TestVariantBranch, error)
- type Analyzer
- type ChangepointRow
- type CheckPoint
- type Client
- type Gitiles
- 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 ¶
This section is empty.
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 CompareTestVariantBranchChangepoint ¶
func CompareTestVariantBranchChangepoint(cpi, cpj *ChangepointRow) 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(rows []*ChangepointRow) [][]*ChangepointRow
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 Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func (*Analyzer) Run ¶
func (a *Analyzer) Run(tvb *testvariantbranch.Entry) []*inputbuffer.Segment
Run runs change point analysis and returns the remaining segment in the input buffer after eviction.
type ChangepointRow ¶
type ChangepointRow 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 verdict unexpected rate before the changepoint. UnexpectedVerdictRateBefore float64 // The verdict unexpected rate after the changepoint. UnexpectedVerdictRateAfter float64 // The current verdict unexpected rate. UnexpectedVerdictRateCurrent float64 // 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 CheckPoint ¶
CheckPoint represents a single row in the TestVariantBranchCheckpoint table.
func (CheckPoint) ToMutation ¶
func (cp CheckPoint) ToMutation() *spanner.Mutation
ToMutation return a spanner Mutation to insert a CheckPoint into
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client to read LUCI Analysis changepoints.
func (*Client) ReadChangepoints ¶
func (c *Client) ReadChangepoints(ctx context.Context, project string, week time.Time) ([]*ChangepointRow, 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.
type Gitiles ¶
type Gitiles struct { Host bigquery.NullString Project bigquery.NullString Ref bigquery.NullString }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
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 inputbuffer handles the input buffer of change point analysis.
|
Package inputbuffer handles the input buffer of change point analysis. |
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. |