Documentation
¶
Index ¶
- Constants
- Variables
- func CreateTriage(dbc *gorm.DB, jiraClient *jira.Client, triage models.Triage, req *http.Request) (models.Triage, error)
- func DeleteTriage(dbc *gorm.DB, id int) error
- func GetComponentReportFromBigQuery(ctx context.Context, client *bqcachedclient.Client, dbc *db.DB, ...) (report crtype.ComponentReport, errs []error)
- func GetJobVariantsFromBigQuery(ctx context.Context, client *bqcachedclient.Client) (crtest.JobVariants, []error)
- func GetMatchingRegressedTestForRegression(regression models.TestRegression, report componentreport.ComponentReport) *componentreport.ReportTestSummary
- func GetRegression(dbc *db.DB, id int, views []crview.View, releases []v1.Release, ...) (*models.TestRegression, error)
- func GetTestDetails(ctx context.Context, client *bigquery.Client, dbc *db.DB, ...) (testdetails.Report, []error)
- func GetTriage(dbc *db.DB, id int, req *http.Request) (*models.Triage, error)
- func InjectRegressionHATEOASLinks(regression *models.TestRegression, views []crview.View, releases []v1.Release, ...)
- func ListRegressions(dbc *db.DB, view, release string, views []crview.View, releases []v1.Release, ...) ([]models.TestRegression, error)
- func ListTriages(dbc *db.DB, req *http.Request) ([]models.Triage, error)
- func ReportTriageAddedForJira(jiraClient *jira.Client, triage models.Triage, req *http.Request)
- func ReportTriageResolved(jiraClient *jira.Client, triage models.Triage)
- func UpdateTriage(dbc *gorm.DB, jiraClient *jira.Client, triage models.Triage, req *http.Request) (models.Triage, error)
- type CacheVariants
- type ComponentReportGenerator
- func (c *ComponentReportGenerator) GenerateCacheVariants(ctx context.Context) (CacheVariants, []error)
- func (c *ComponentReportGenerator) GenerateDetailsReportForTest(ctx context.Context, testIDOption reqopts.TestIdentification, ...) (testdetails.Report, []error)
- func (c *ComponentReportGenerator) GenerateJobVariants(ctx context.Context) (crtest.JobVariants, []error)
- func (c *ComponentReportGenerator) GenerateReport(ctx context.Context) (crtype.ComponentReport, []error)
- func (c *ComponentReportGenerator) GenerateTestDetailsReport(ctx context.Context) (testdetails.Report, []error)
- func (c *ComponentReportGenerator) GenerateTestDetailsReportMultiTest(ctx context.Context) ([]testdetails.Report, []error)
- func (c *ComponentReportGenerator) GetCacheKey(ctx context.Context) GeneratorCacheKey
- func (c *ComponentReportGenerator) PostAnalysis(report *crtype.ComponentReport) error
- func (c *ComponentReportGenerator) PostAnalysisTestDetails(report *testdetails.Report) error
- type FieldChange
- type GeneratorCacheKey
- type GeneratorType
- type PostgresRegressionStore
- func (prs *PostgresRegressionStore) ListCurrentRegressionsForRelease(release string) ([]*models.TestRegression, error)
- func (prs *PostgresRegressionStore) OpenRegression(view crview.View, newRegressedTest crtype.ReportTestSummary) (*models.TestRegression, error)
- func (prs *PostgresRegressionStore) ResolveTriages() error
- func (prs *PostgresRegressionStore) UpdateRegression(reg *models.TestRegression) error
- type PotentialMatch
- type PotentialMatchingRegression
- type PotentialMatchingTriage
- type RegressionStore
- type RegressionTracker
- func (rt *RegressionTracker) Errors() []error
- func (rt *RegressionTracker) Load()
- func (rt *RegressionTracker) Name() string
- func (rt *RegressionTracker) SyncRegressionsForReport(ctx context.Context, view crview.View, rLog *log.Entry, ...) error
- func (rt *RegressionTracker) SyncRegressionsForView(ctx context.Context, view crview.View) error
- type SimilarlyNamedTest
- type TriageAuditLog
Constants ¶
const (
ComponentReportCacheKeyPrefix = "ComponentReport~"
)
Variables ¶
var ( DefaultColumnGroupBy = "Platform,Architecture,Network" DefaultDBGroupBy = "Platform,Architecture,Network,Topology,FeatureSet,Upgrade,Suite,Installer,LayeredProduct" )
Functions ¶
func CreateTriage ¶
func GetComponentReportFromBigQuery ¶
func GetComponentReportFromBigQuery( ctx context.Context, client *bqcachedclient.Client, dbc *db.DB, reqOptions reqopts.RequestOptions, variantJunitTableOverrides []configv1.VariantJunitTableOverride, baseURL string, ) (report crtype.ComponentReport, errs []error)
func GetJobVariantsFromBigQuery ¶
func GetJobVariantsFromBigQuery(ctx context.Context, client *bqcachedclient.Client) (crtest.JobVariants, []error)
func GetMatchingRegressedTestForRegression ¶
func GetMatchingRegressedTestForRegression(regression models.TestRegression, report componentreport.ComponentReport) *componentreport.ReportTestSummary
func GetRegression ¶
func GetRegression(dbc *db.DB, id int, views []crview.View, releases []v1.Release, crTimeRoundingFactor time.Duration, req *http.Request) (*models.TestRegression, error)
GetRegression returns the regression with the matching ID
func GetTestDetails ¶
func InjectRegressionHATEOASLinks ¶
func InjectRegressionHATEOASLinks(regression *models.TestRegression, views []crview.View, releases []v1.Release, crTimeRoundingFactor time.Duration, baseURL string)
InjectRegressionHATEOASLinks adds restful links clients can follow for this regression record.
func ListRegressions ¶
func ListRegressions(dbc *db.DB, view, release string, views []crview.View, releases []v1.Release, crTimeRoundingFactor time.Duration, req *http.Request) ([]models.TestRegression, error)
ListRegressions lists all regressions for the provided view OR release
func ReportTriageAddedForJira ¶
ReportTriageAddedForJira comments on the associated jira with a link to the triage details
func ReportTriageResolved ¶
ReportTriageResolved comments on the associated jira that the regressions have been resolved, including a link to the triage details
Types ¶
type CacheVariants ¶
type CacheVariants struct {
Network []string `json:"network,omitempty"`
Upgrade []string `json:"upgrade,omitempty"`
Arch []string `json:"arch,omitempty"`
Platform []string `json:"platform,omitempty"`
Variant []string `json:"variant,omitempty"`
}
CacheVariants is used only in the cache key, not in the actual report.
func GetComponentTestVariantsFromBigQuery ¶
func GetComponentTestVariantsFromBigQuery(ctx context.Context, client *bqcachedclient.Client) (CacheVariants, []error)
type ComponentReportGenerator ¶
type ComponentReportGenerator struct {
ReqOptions reqopts.RequestOptions
// contains filtered or unexported fields
}
ComponentReportGenerator contains the information needed to generate a CR report. Do not add public fields to this struct if they are not valid as a cache key. GeneratorVersion is used to indicate breaking changes in the versions of the cached data. It is used when the struct is marshalled for the cache key and should be changed when the object being cached changes in a way that will no longer be compatible with any prior cached version.
func NewComponentReportGenerator ¶
func NewComponentReportGenerator(client *bqcachedclient.Client, reqOptions reqopts.RequestOptions, dbc *db.DB, variantJunitTableOverrides []configv1.VariantJunitTableOverride, releaseConfigs []v1.Release, baseURL string) ComponentReportGenerator
func (*ComponentReportGenerator) GenerateCacheVariants ¶
func (c *ComponentReportGenerator) GenerateCacheVariants(ctx context.Context) (CacheVariants, []error)
func (*ComponentReportGenerator) GenerateDetailsReportForTest ¶
func (c *ComponentReportGenerator) GenerateDetailsReportForTest( ctx context.Context, testIDOption reqopts.TestIdentification, componentJobRunTestReportStatus bq.TestJobRunStatuses, allowUnregressedReports bool, ) (testdetails.Report, []error)
GenerateDetailsReportForTest generates a test detail report for a per-test + variant combo.
func (*ComponentReportGenerator) GenerateJobVariants ¶
func (c *ComponentReportGenerator) GenerateJobVariants(ctx context.Context) (crtest.JobVariants, []error)
func (*ComponentReportGenerator) GenerateReport ¶
func (c *ComponentReportGenerator) GenerateReport(ctx context.Context) (crtype.ComponentReport, []error)
GenerateReport is the main entry point for generation of a component readiness report.
func (*ComponentReportGenerator) GenerateTestDetailsReport ¶
func (c *ComponentReportGenerator) GenerateTestDetailsReport(ctx context.Context) (testdetails.Report, []error)
GenerateTestDetailsReport is the main function to generate a test details report for a request, if we miss the cache.
func (*ComponentReportGenerator) GenerateTestDetailsReportMultiTest ¶
func (c *ComponentReportGenerator) GenerateTestDetailsReportMultiTest(ctx context.Context) ([]testdetails.Report, []error)
GenerateTestDetailsReportMultiTest variant of the function is for multi-test reports, used for cache priming all test detail reports for a view.
func (*ComponentReportGenerator) GetCacheKey ¶
func (c *ComponentReportGenerator) GetCacheKey(ctx context.Context) GeneratorCacheKey
GetCacheKey creates a cache key using the generator properties that we want included for uniqueness in what we cache. This provides a safer option than using the generator previously which carries some public fields which would be serialized and thus cause unnecessary cache misses. Here we should normalize to output the same cache key regardless of how fields were initialized. (nil vs empty, etc)
func (*ComponentReportGenerator) PostAnalysis ¶
func (c *ComponentReportGenerator) PostAnalysis(report *crtype.ComponentReport) error
PostAnalysis runs the PostAnalysis method for all middleware on this component report. This is done outside the caching mechanism so we can load fresh data from our db (which is fast and cheap), and inject it into an expensive / slow report without recalculating everything.
func (*ComponentReportGenerator) PostAnalysisTestDetails ¶
func (c *ComponentReportGenerator) PostAnalysisTestDetails(report *testdetails.Report) error
PostAnalysisTestDetails runs the PostAnalysis method for all middleware on this test details report. This is done outside the caching mechanism so we can load fresh data from our db (which is fast and cheap), and inject it into an expensive / slow report without recalculating everything.
type FieldChange ¶
type FieldChange struct {
FieldName string `json:"field_name"`
Original string `json:"original"`
Modified string `json:"modified"`
}
FieldChange represents a change to a specific field
type GeneratorCacheKey ¶
type GeneratorType ¶
type GeneratorType string
type PostgresRegressionStore ¶
type PostgresRegressionStore struct {
// contains filtered or unexported fields
}
func (*PostgresRegressionStore) ListCurrentRegressionsForRelease ¶
func (prs *PostgresRegressionStore) ListCurrentRegressionsForRelease(release string) ([]*models.TestRegression, error)
func (*PostgresRegressionStore) OpenRegression ¶
func (prs *PostgresRegressionStore) OpenRegression(view crview.View, newRegressedTest crtype.ReportTestSummary) (*models.TestRegression, error)
func (*PostgresRegressionStore) ResolveTriages ¶
func (prs *PostgresRegressionStore) ResolveTriages() error
ResolveTriages sets the resolution time on any triages that no longer have active regressions It only does so when all the regressions have been closed for at least regressionHysteresisDays (5) days
func (*PostgresRegressionStore) UpdateRegression ¶
func (prs *PostgresRegressionStore) UpdateRegression(reg *models.TestRegression) error
type PotentialMatch ¶
type PotentialMatch struct {
// SimilarlyNamedTests contains each of the already associated regressions that have a similar name, and their editDistance difference
SimilarlyNamedTests []SimilarlyNamedTest `json:"similarly_named_tests"`
// SameLastFailures contains each of the already associated regressions that have the same last failure time
// This shows us that the regressions were found in the same job, indicating a higher likelihood of correlation.
SameLastFailures []models.TestRegression `json:"same_last_failures"`
// ConfidenceLevel is a number between 0-10 with a higher number being more likely to be a proper match
ConfidenceLevel int `json:"confidence_level"`
// Links include HATEOAS links to related resources
Links map[string]string `json:"links"`
}
type PotentialMatchingRegression ¶
type PotentialMatchingRegression struct {
*PotentialMatch
// RegressedTest contains all the info about the potentially matching regression
RegressedTest componentreport.ReportTestSummary `json:"regressed_test"`
}
func GetTriagePotentialMatches ¶
func GetTriagePotentialMatches(triage *models.Triage, allRegressions []models.TestRegression, componentReport componentreport.ComponentReport, req *http.Request) ([]PotentialMatchingRegression, error)
GetTriagePotentialMatches returns a list of PotentialMatchingRegression including all possible matching regressions for a given triage, and componentReport. It calculates this based on similarly named tests being regressed, and regressions that have the same last failure time. It includes a confidence level for each match that states how likely the match is to be relevant.
type PotentialMatchingTriage ¶
type PotentialMatchingTriage struct {
*PotentialMatch
// Triage is the triage that this regression potentially matches
Triage models.Triage `json:"triage"`
}
func GetRegressionPotentialMatchingTriages ¶
func GetRegressionPotentialMatchingTriages(regression models.TestRegression, triages []models.Triage, req *http.Request) ([]PotentialMatchingTriage, error)
GetRegressionPotentialMatchingTriages returns a list of PotentialMatchingTriage including all possible matching triages for a given regression. It calculates this based on similarly named tests being regressed, and associated regressions that have the same last failure time. It includes a confidence level for each match that states how likely the match is to be relevant.
type RegressionStore ¶
type RegressionStore interface {
// ListCurrentRegressionsForRelease returns *all* regressions for the given release. We operate on the assumption that
// only one view is allowed to have regression tracking enabled (i.e. 4.18-main) per release, which is validated
// when the views file is loaded. This is because we want to display regression tracking data on any report that shows
// a regressed test, so people using custom reporting can see what is regressed in main as well.
ListCurrentRegressionsForRelease(release string) ([]*models.TestRegression, error)
OpenRegression(view crview.View, newRegressedTest crtype.ReportTestSummary) (*models.TestRegression, error)
UpdateRegression(reg *models.TestRegression) error
// ResolveTriages sets the resolution time on any triages that no longer have active regressions
ResolveTriages() error
}
RegressionStore is an underlying interface for where we store/load data on open test regressions.
func NewPostgresRegressionStore ¶
func NewPostgresRegressionStore(dbc *db.DB, jiraClient *jira.Client) RegressionStore
type RegressionTracker ¶
type RegressionTracker struct {
// contains filtered or unexported fields
}
RegressionTracker is the primary object for managing regression tracking logic.
func NewRegressionTracker ¶
func NewRegressionTracker( bigqueryClient *sippybigquery.Client, dbc *db.DB, cacheOptions cache.RequestOptions, releases []v1.Release, backend RegressionStore, views []crview.View, overrides []configv1.VariantJunitTableOverride, dryRun bool) *RegressionTracker
func (*RegressionTracker) Errors ¶
func (rt *RegressionTracker) Errors() []error
func (*RegressionTracker) Load ¶
func (rt *RegressionTracker) Load()
Load iterates all views with regression tracking enabled and syncs the results of its component report to the regression tables.
func (*RegressionTracker) Name ¶
func (rt *RegressionTracker) Name() string
func (*RegressionTracker) SyncRegressionsForReport ¶
func (rt *RegressionTracker) SyncRegressionsForReport(ctx context.Context, view crview.View, rLog *log.Entry, report *crtype.ComponentReport) error
func (*RegressionTracker) SyncRegressionsForView ¶
type SimilarlyNamedTest ¶
type SimilarlyNamedTest struct {
Regression models.TestRegression `json:"regression"`
EditDistance int `json:"edit_distance"`
}
type TriageAuditLog ¶
type TriageAuditLog struct {
Operation string `json:"operation"`
Changes []FieldChange `json:"changes,omitempty"`
User string `json:"user"`
CreatedAt time.Time `json:"created_at"`
// Links include HATEOAS links to related resources
Links map[string]string `json:"links"`
}
TriageAuditLog represents an audit log with processed change data
func GetTriageAuditDetails ¶
GetTriageAuditDetails processes audit logs for a triage and returns response-ready audit log data