messages

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GoogleTimeZone is the timezone used by the services whose
	// messages this package parses.
	GoogleTimeZone = "UTC"

	// AlertHungBuilder indicates that a builder has been executing a step for too long.
	AlertHungBuilder = "hung-builder"

	// AlertOfflineBuilder indicates that we have no recent updates from the builder.
	AlertOfflineBuilder = "offline-builder"

	// AlertIdleBuilder indicates that a builder has not executed any builds recently
	// even though it has requests queued up.
	AlertIdleBuilder = "idle-builder"

	// AlertInfraFailure indicates that a builder step failed due to infrastructure
	// problems rather than errors in the code it tried to build or execute.
	AlertInfraFailure = "infra-failure"

	// AlertBuildFailure indicates that one of the build steps failed, most likely
	// due to the patch it's building/running with.
	AlertBuildFailure = "build-failure"

	// AlertTestFailure indicates that one of the test steps failed
	AlertTestFailure = "test-failure"
)
View Source
const (
	// ResultOK is a step result which is deemed as ok. For some reason, 1 is not
	// a failure. Copied from legacy code :/
	ResultOK = float64(1)
	// ResultInfraFailure is a step result which is deemed an infra failure.
	ResultInfraFailure = float64(4)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Key       string    `json:"key"`
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	Severity  Severity  `json:"severity"` // TODO: consider using an enum.
	Time      EpochTime `json:"time"`
	StartTime EpochTime `json:"start_time"`
	Links     []*Link   `json:"links"`
	Tags      []string  `json:"tags"`
	// Type determines what kind of extension has been set on the Alert.
	Type AlertType `json:"type"`
	// Extension may take on different concrete types depending on the
	// code that generates the Alert.
	Extension interface{} `json:"extension"`
}

Alert represents a condition that should be examined by a human.

type AlertType

type AlertType string

AlertType is a type of alert; used for categorizing and grouping alerts on the SOM frontend.

type AlertedBuilder

type AlertedBuilder struct {
	Name         string    `json:"name"`
	BuilderGroup string    `json:"builder_group"`
	URL          string    `json:"url"`
	StartTime    EpochTime `json:"start_time"`
	// FirstFailure is the build ID of first failure.
	FirstFailure int64 `json:"first_failure"`
	// LatestFailure is the build ID of latest failure.
	LatestFailure            int64  `json:"latest_failure"`
	FirstFailureBuildNumber  int64  `json:"first_failure_build_number"`
	LatestFailureBuildNumber int64  `json:"latest_failure_build_number"`
	FirstFailureURL          string `json:"first_failure_url"`
	LatestFailureURL         string `json:"latest_failure_url"`

	// LatestPassing is the build number of latest passing build
	LatestPassing     int64            `json:"latest_passing"`
	LatestPassingRev  *RevisionSummary `json:"last_passing_rev"`
	FirstFailingRev   *RevisionSummary `json:"first_failing_rev"`
	Count             int              `json:"count"`
	Project           string           `json:"project"`
	Bucket            string           `json:"bucket"`
	FailingTestsTrunc string           `json:"failing_tests_trunc"`
	NumFailingTests   int64            `json:"num_failing_tests"`
	BuildStatus       string           `json:"build_status"`
}

AlertedBuilder represents an individual builder.

type Alerts

type Alerts []*Alert

Alerts is a slice of alerts, sorted by Key by default

func (Alerts) Len

func (a Alerts) Len() int

func (Alerts) Less

func (a Alerts) Less(i, j int) bool

func (Alerts) Swap

func (a Alerts) Swap(i, j int)

type AlertsSummary

type AlertsSummary struct {
	Alerts            []*Alert                    `json:"alerts"`
	Resolved          []*Alert                    `json:"resolved"`
	RevisionSummaries map[string]*RevisionSummary `json:"revision_summaries"`
	Timestamp         EpochTime                   `json:"timestamp"`
}

AlertsSummary is the top-level entity in alerts.json.

type Build

type Build struct {
	BuilderName string `json:"builderName"`
}

Build represents a buildbot build.

type BuildFailure

type BuildFailure struct {
	TreeCloser       bool               `json:"tree_closer"`
	Builders         []*AlertedBuilder  `json:"builders"`
	StepAtFault      *BuildStep         `json:"-"`
	Reason           *Reason            `json:"reason"`
	RegressionRanges []*RegressionRange `json:"regression_ranges"`
	SuspectedCLs     []*SuspectCL       `json:"suspected_cls"`
	// Status of Findit analysis: RUNNING or FINISHED.
	FinditStatus string `json:"findit_status"`
	// Url to Findit result page.
	FinditURL   string `json:"findit_url"`
	HasFindings bool   `json:"has_findings"`
	IsFinished  bool   `json:"is_finished"`
	IsSupported bool   `json:"is_supported"`
	// New struct for the culprits found by Findit.
	// Culprit is essentially the same as SuspectedCL, but it has more
	// gitiles information like host/project/ref to identify a commit, so
	// that it can support different LUCI projects easily.
	// When presents, SuspectedCLs should be empty.
	Culprits []*Culprit `json:"culprits"`
}

BuildFailure is an Extension.

type BuildIdentifierByNumber

type BuildIdentifierByNumber struct {
	Project string `json:"project"`
	Bucket  string `json:"bucket"`
	Builder string `json:"builder"`
	Number  int64  `json:"number"`
}

BuildIdentifierByNumber is the alternative way to identify a LUCI build.

type BuildStep

type BuildStep struct {
	BuilderGroup *BuilderGroupLocation
	Build        *Build
	Step         *Step
}

BuildStep is a step which was run in a particular build. Useful for analyzing and generating additional data for extensions.

type BuilderGroupLocation

type BuilderGroupLocation struct {
	url.URL
}

BuilderGroupLocation is the location of a builder group. Currently it's just a URL.

func (*BuilderGroupLocation) Name

func (m *BuilderGroupLocation) Name() string

Name is the name of the builder group; chromium, chromium.linux, etc.

type Change

type Change struct {
	At         string          `json:"at"`
	Branch     string          `json:"branch"`
	Category   string          `json:"category"`
	Comments   string          `json:"comments"`
	Files      []Files         `json:"files"`
	Number     int64           `json:"number"`
	Project    string          `json:"project"`
	Properties [][]interface{} `json:"properties"`
	Repository string          `json:"repository"`
	Rev        string          `json:"rev"`
	Revision   string          `json:"revision"`
	Revlink    string          `json:"revlink"`
	When       EpochTime       `json:"when"`
	Who        string          `json:"who"`
}

Change is an automatically generated type.

func (*Change) CommitPosition

func (c *Change) CommitPosition() (string, int, error)

CommitPosition parses the comments of a change to find something which looks like a commit position git footer.

type CrbugAuthor

type CrbugAuthor struct {
	HTMLLink string `json:"htmlLink"`
	Kind     string `json:"kind"`
	Name     string `json:"name"`
}

CrbugAuthor is the author of an issue.

type CrbugItem

type CrbugItem struct {
	Author     CrbugAuthor `json:"author"`
	CanComment bool        `json:"canComment"`
	CanEdit    bool        `json:"canEdit"`
	ID         float64     `json:"id"`
	Kind       string      `json:"kind"`
	Labels     []string    `json:"labels"`
	ProjectID  string      `json:"projectId"`
	Published  string      `json:"published"`
	Starred    bool        `json:"starred"`
	Stars      float64     `json:"stars"`
	State      string      `json:"state"`
	Status     string      `json:"status"`
	Summary    string      `json:"summary"`
	Title      string      `json:"title"`
	Updated    string      `json:"updated"`
}

CrbugItem represents an issue in crbug.

type CrbugSearchResults

type CrbugSearchResults struct {
	Items        []CrbugItem `json:"items"`
	Kind         string      `json:"kind"`
	TotalResults float64     `json:"totalResults"`
}

CrbugSearchResults conatains issue search results from crbug.

type Culprit

type Culprit struct {
	Commit   *GitilesCommit `json:"commit"`
	Revert   *GerritChange  `json:"revert"`
	Markdown string         `json:"markdown"`
}

Culprit is a CL which is suspected to have caused a failure.

type EpochTime

type EpochTime float64

EpochTime is used for marshalling timestamps represented as doubles in json.

func TimeToEpochTime

func TimeToEpochTime(t time.Time) EpochTime

TimeToEpochTime converts a time.Time value to a EpochTime value.

func (EpochTime) Time

func (j EpochTime) Time() time.Time

Time returns a time.Time value corresponding to the json value.

type Files

type Files struct {
	Name string                 `json:"name"`
	URL  map[string]interface{} `json:"url"`
}

Files is an automatically generated type.

type FinditResultV2

type FinditResultV2 struct {
	BuildID            int64                    `json:"build_id"`
	BuildAlternativeID *BuildIdentifierByNumber `json:"build_alternative_id"`
	StepName           string                   `json:"step_name"`
	TestName           string                   `json:"test_name"`
	LastPassedCommit   *GitilesCommit           `json:"last_passed_commit"`
	FirstFailedCommit  *GitilesCommit           `json:"first_failed_commit"`
	Culprits           []*Culprit               `json:"culprits"`
	IsFinished         bool                     `json:"is_finished"`
	IsSupported        bool                     `json:"is_supported"`
	IsFlakyTest        bool                     `json:"is_flaky_test"`
	Markdown           string                   `json:"markdown"`
}

FinditResultV2 is the result of request to the findit server using buildbucket concepts. INTERNAL ONLY: For documentation of data format and fields, please check: https://docs.google.com/a/google.com/document/d/1u2O9iGroKKpL38SSK2E_krK29P5PeFI9fM_hgFkjGRc/edit?usp=sharing

type GerritChange

type GerritChange struct {
	Host     string `json:"host"`
	Project  string `json:"project"`
	Change   int64  `json:"change"`
	Patchset int64  `json:"patchset"`
	IsLanded bool   `json:"is_landed"`
}

GerritChange is information about a gerrit change.

type GitilesCommit

type GitilesCommit struct {
	Host           string `json:"host"`
	Project        string `json:"project"`
	ID             string `json:"id"`
	Ref            string `json:"ref"`
	CommitPosition int    `json:"commit_position"`
}

GitilesCommit is information about a gitiles commit.

type Link struct {
	Title string `json:"title"`
	Href  string `json:"href"`
}

Link can be attached to an alert to provide more context to the sheriff.

type Reason

type Reason struct {
	Raw ReasonRaw
}

Reason is the cause of a build extension failure.

func (*Reason) Kind

func (r *Reason) Kind() string

Kind is the kind of the reason. Useful for categorization.

func (*Reason) MarshalJSON

func (r *Reason) MarshalJSON() ([]byte, error)

MarshalJSON returns the json marshalled version of the Reason. Delegates to the raw reason.

func (*Reason) Signature

func (r *Reason) Signature() string

Signature is a unique identifier for reasons of the same Kind.

func (*Reason) Title

func (r *Reason) Title(bses []*BuildStep) string

Title returns a title a group of build steps should have, as an alert.

type ReasonRaw

type ReasonRaw interface {
	Signature() string
	Kind() string
	Severity() Severity
	Title([]*BuildStep) string
}

ReasonRaw is the interface any results an analysis pipeline outputs must implement.

type RegressionRange

type RegressionRange struct {
	Repo string `json:"repo"`
	URL  string `json:"url"`
	// Revisions have the first and last revisions in the range,
	// And RevisionsWithResults have the revisions that are suspected.
	Revisions            []string                    `json:"revisions"`
	Positions            []string                    `json:"positions"`
	RevisionsWithResults []*RevisionWithFinditResult `json:"revisions_with_results"`
	Host                 string                      `json:"host"`
}

RegressionRange identifies the bounds of the location of a regression.

type RevisionSummary

type RevisionSummary struct {
	GitHash     string    `json:"git_hash"`
	Position    int       `json:"commit_position"`
	Branch      string    `json:"branch"`
	Link        string    `json:"link"`
	Description string    `json:"description"`
	Author      string    `json:"author"`
	When        EpochTime `json:"when"`
	// Host and Repo were added to differentiate chromium from chromeos revisions.
	Host string `json:"host"`
	Repo string `json:"repo"`
}

RevisionSummary summarizes some information about a revision.

type RevisionWithFinditResult

type RevisionWithFinditResult struct {
	Revision string `json:"revision"`

	// A flag to determine if Findit finds it to be a culprit to some failures.
	IsSuspect bool `json:"is_suspect"`

	// A score calculated by Findit based on historical triaging results of the same type of suspected CLs.
	// Only has value when IsSuspect is true.
	Confidence int `json:"confidence"`

	// Used to indicate how Findit finds this CL as a suspect.
	// Only has a [value when IsSuspect is true.
	AnalysisApproach string `json:"analysis_approach"`
}

RevisionWithFinditResult saves information from Findit about a specific revision.

type Severity

type Severity int

Severity is a sorted order of how severe an alert is.

const (
	// TreeCloser is an alert which closes the tree. Highest priority alert.
	TreeCloser Severity = 0
	// HungBuilder is an alert about a builder being hung (stuck running a particular step)
	HungBuilder Severity = 2
	// InfraFailure is an infrastructure failure. It is higher severity than a reliable failure
	// because if there is an infrastructure failure, the test code is not even run,
	// and so we are losing data about if the tests pass or not.
	InfraFailure Severity = 3
	// ReliableFailure is a failure which has shown up multiple times.
	ReliableFailure Severity = 4
	// NewFailure is a failure which just started happening.
	NewFailure Severity = 5
	// IdleBuilder is a builder which is "idle" (buildbot term) and which has above
	// a certain threshold of pending builds.
	IdleBuilder Severity = 6
	// OfflineBuilder is a builder which is offline.
	OfflineBuilder Severity = 7
	// NoSeverity is a placeholder Severity value which means nothing. Used by analysis
	// to indicate that it doesn't have a particular Severity to assign to an alert.
	NoSeverity Severity = 8
)

type Step

type Step struct {
	Eta          EpochTime         `json:"eta"`
	Expectations [][]interface{}   `json:"expectations"`
	Hidden       bool              `json:"hidden"`
	IsFinished   bool              `json:"isFinished"`
	IsStarted    bool              `json:"isStarted"`
	Logs         [][]interface{}   `json:"logs"`
	Links        map[string]string `json:"urls"`
	Name         string            `json:"name"`
	// Results is a homogenous array. Use runtime introspection to
	// determine element types.
	Results    []interface{} `json:"results"`
	StepNumber float64       `json:"step_number"`
	Text       []string      `json:"text"`
	Times      []EpochTime   `json:"times"`
}

Step is an automatically generated type.

func (*Step) IsOK

func (s *Step) IsOK() (bool, error)

IsOK returns if the step had an "ok" result. Ok means it didn't fail.

func (*Step) Result

func (s *Step) Result() (float64, error)

Result returns the step result. It does some runtime parsing, because buildbot's json is weird and untyped :(

type SuspectCL

type SuspectCL struct {
	RepoName         string `json:"repo_name"`
	Revision         string `json:"revision"`
	CommitPosition   int64  `json:"commit_position,omitempty"`
	Confidence       int    `json:"confidence"`
	AnalysisApproach string `json:"analysis_approach"`
	RevertCLURL      string `json:"revert_cl_url"`
	RevertCommitted  bool   `json:"revert_committed"`
}

SuspectCL is a CL which is suspected to have caused a failure.

Jump to

Keyboard shortcuts

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