analyzer

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StepCompletedRun is a synthetic step name used to indicate the build run is complete.
	StepCompletedRun = "completed run"
)

Variables

This section is empty.

Functions

func GetBigQueryAlerts

func GetBigQueryAlerts(ctx context.Context, tree string) ([]*messages.BuildFailure, error)

GetBigQueryAlerts generates alerts for currently failing build steps, using BigQuery to do most of the heavy lifting. Note that this returns alerts for all failing steps, so filtering should be applied on the return value. TODO: Some post-bq result merging with heuristics:

  • Merge alerts for sets of multiple failing steps. Currently will return one alert for each failing step on a builder. If step_a and step_b are failing on the same builder or set of builders, they should be merged into a single alert.

func QueryBQForProject

func QueryBQForProject(ctx context.Context, project string) error

QueryBQForProject queries the sheriffable_failures for a project and stores the result in memcache.

Types

type Analyzer

type Analyzer struct {
	// MaxRecentBuilds is the maximum number of recent builds to check, per builder.
	MaxRecentBuilds int

	// MinRecentBuilds is the minimum number of recent builds to check, per builder.
	MinRecentBuilds int

	// HungBuilerThresh is the maxumum length of time a builder may be in state "building"
	// before triggering a "hung builder" alert.
	HungBuilderThresh time.Duration

	// OfflineBuilderThresh is the maximum length of time a builder may be in state "offline"
	//  before triggering an "offline builder" alert.
	OfflineBuilderThresh time.Duration

	// IdleBuilderCountThresh is the maximum number of builds a builder may have in queue
	// while in the "idle" state before triggering an "idle builder" alert.
	IdleBuilderCountThresh int64

	// Now is useful for mocking the system clock in testing and simulating time
	// during replay.
	Now func() time.Time

	// Mock these out in tests.
	CrBug  client.CrBug
	FindIt client.FindIt
	// contains filtered or unexported fields
}

Analyzer runs the process of checking builder groups, builders, test results and so on, in order to produce alerts.

func CreateAnalyzer

func CreateAnalyzer(c context.Context) *Analyzer

CreateAnalyzer creates a new analyzer and set its service clients.

func New

func New(minBuilds, maxBuilds int) *Analyzer

New returns a new Analyzer. If client is nil, it assigns a default implementation. maxBuilds is the maximum number of builds to check, per builder.

func (*Analyzer) GetRevisionSummaries

func (a *Analyzer) GetRevisionSummaries(hashes []string) ([]*messages.RevisionSummary, error)

GetRevisionSummaries returns a slice of RevisionSummaries for the list of hashes.

type BuilderGroupConfig

type BuilderGroupConfig struct {
	ExcludedBuilders []string `json:"excluded_builders"`
}

BuilderGroupConfig is a parsed representation of the inner per builder group value, which contains a list of builders to exclude for that builder group.

type ConfigRules

type ConfigRules struct {
	IgnoredSteps     []string                      `json:"ignored_steps"`
	BuilderGroupCfgs map[string]BuilderGroupConfig `json:"builder_groups"`
}

ConfigRules is a parsed representation of the config.json file, which specifies builders and steps to exclude.

func GetConfigRules

func GetConfigRules(c context.Context) (*ConfigRules, error)

GetConfigRules fetches the latest version of the config from Gitiles.

func ParseConfigRules

func ParseConfigRules(cfgJSON []byte) (*ConfigRules, error)

ParseConfigRules parses the given byte array into a ConfigRules object. Public so that parse_config_test can use it.

func (*ConfigRules) ExcludeFailure

func (r *ConfigRules) ExcludeFailure(ctx context.Context, builderGroup, builder, step string) bool

ExcludeFailure determines whether a particular failure should be ignored, according to the rules in the config.

type GitCommit

type GitCommit struct {
	Project  bigquery.NullString
	Ref      bigquery.NullString
	Host     bigquery.NullString
	ID       bigquery.NullString
	Position bigquery.NullInt64
}

GitCommit represents a struct column for BQ query results.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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