updater

package
v0.0.0-...-f557d2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package updater contains methods to orchestrate automatic bug management, including automatic bug filing and automatic priority updates/auto-closure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractResidualMetrics

func ExtractResidualMetrics(c *analysis.Cluster) bugs.ClusterMetrics

ExtractResidualMetrics extracts the values of metrics calculated based only on residual failures. For suggested clusters, residual failures are the failures left after failures that are already associated with a bug are removed.

func SetResidualMetrics

func SetResidualMetrics(cs *analysis.Cluster, impact bugs.ClusterMetrics)

SetResidualMetrics sets the value of metrics calculated on residual failures. This method exists for testing purposes only.

func UpdateBugsForProject

func UpdateBugsForProject(ctx context.Context, opts UpdateOptions) (retErr error)

UpdateBugsForProject updates LUCI Analysis-managed bugs for a particular LUCI project.

Types

type AnalysisClient

type AnalysisClient interface {
	// ReadImpactfulClusters reads analysis for clusters matching the
	// specified criteria.
	ReadImpactfulClusters(ctx context.Context, opts analysis.ImpactfulClusterReadOptions) ([]*analysis.Cluster, error)
}

AnalysisClient is an interface for building and accessing cluster analysis.

type BugManager

type BugManager interface {
	// Create creates a new bug for the given request, returning its ID
	// (if a bug was created) and any encountered error.
	Create(ctx context.Context, request bugs.BugCreateRequest) bugs.BugCreateResponse
	// Update updates the specified list of bugs.
	//
	// Exactly one response item is returned for each request item.
	// If an error is encountered on a specific bug, the error is recorded
	// on the bug's response item and processing continues.
	//
	// If a catastrophic error occurs, the error is returned
	// at the top-level and the responses slice should be ignored.
	Update(ctx context.Context, bugs []bugs.BugUpdateRequest) ([]bugs.BugUpdateResponse, error)
	// GetMergedInto reads the bug the given bug is merged into (if any).
	// This is to allow step-wise discovery of the canonical bug a bug
	// is merged into (if it exists and there is no cycle in the bug
	// merged-into graph).
	GetMergedInto(ctx context.Context, bug bugs.BugID) (*bugs.BugID, error)
	// UpdateDuplicateSource updates the source bug of a duplicate
	// bug relationship.
	// It normally posts a message advising the user LUCI Analysis
	// has merged the rule for the source bug to the destination
	// (merged-into) bug, and provides a new link to the failure
	// association rule.
	// If a cycle was detected, it instead posts a message that the
	// duplicate bug could not be handled and marks the bug no
	// longer a duplicate to break the cycle.
	UpdateDuplicateSource(ctx context.Context, request bugs.UpdateDuplicateSourceRequest) error
}

BugManager implements bug creation and bug updates for a bug-tracking system. The BugManager determines bug content and priority given a cluster.

type BugUpdater

type BugUpdater struct {

	// MaxBugsFiledPerRun is the maximum number of bugs to file each time
	// BugUpdater runs. This throttles the rate of changes to the bug system.
	MaxBugsFiledPerRun int
	// UpdateRuleBatchSize is the maximum number of rules to update in one
	// transaction, when updating rule bug management state.
	UpdateRuleBatchSize int
	// Timestamp of the cron job. Used to timestamp policy activations/deactivations
	// that happen as a result of this run.
	RunTimestamp time.Time
	// contains filtered or unexported fields
}

BugUpdater performs updates to bugs and failure association rules to keep them in sync with clusters generated by analysis.

func NewBugUpdater

func NewBugUpdater(project string, mgrs map[string]BugManager, ac AnalysisClient, projectCfg *compiledcfg.ProjectConfig, runTimestamp time.Time) *BugUpdater

NewBugUpdater initialises a new BugUpdater.

func (*BugUpdater) Run

func (b *BugUpdater) Run(ctx context.Context, reclusteringProgress *runs.ReclusteringProgress) error

Run files/updates bugs to match high-impact clusters as identified by analysis. Each bug has a corresponding failure association rule. The passed progress should reflect the progress of re-clustering as captured in the latest analysis.

type UpdateOptions

type UpdateOptions struct {
	UIBaseURL            string
	Project              string
	AnalysisClient       AnalysisClient
	BuganizerClient      buganizer.Client
	SimulateBugUpdates   bool
	MaxBugsFiledPerRun   int
	UpdateRuleBatchSize  int
	ReclusteringProgress *runs.ReclusteringProgress
	RunTimestamp         time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL