summary

package
v0.0.0-...-d3aaeb6 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package summary our model that summarizes a Bazel Invocation or set of invocations.

The summary package contains functions to produce a summary from an event stream, and so it depends on pkg/events.

This package contains types to hold a summary in-memory. It is not responsible for persisting or viewing summary documents. Therefore, it should not have many dependencies except for pkg/events. It should not depend on libraries or frameworks related to databases, HTML, GraphQL, PDF, email, etc. Other packages can provide functions that take an in-memory summary & use those libraries to persist/render/display it.

Index

Constants

View Source
const (
	ExitCodeSuccess     = 0
	ExitCodeInterrupted = 8
)

Exit Code constant.

Variables

This section is empty.

Functions

func IsBuildEnvKey

func IsBuildEnvKey(k string) bool

IsBuildEnvKey checks if an environment variable key is a build-level environment variable - one that is expected to be the same for multiple invocations that occur as part of the same build.

In this context, "Build" refers to a CI build, like a Jenkins build, not a 'bazel build'.

Types

type AbortReason

type AbortReason int32

AbortReason enum.

const (
	AbortedUNKNOWN                  AbortReason = 0
	AbortedUSERINTERRUPTED          AbortReason = 1
	AbortedTIMEOUT                  AbortReason = 2
	AbortedREMOTEENVIRONMENTFAILURE AbortReason = 3
	AbortedINTERNAL                 AbortReason = 4
	AbortedLOADINGFAILURE           AbortReason = 5
	AbortedANALYSISFAILURE          AbortReason = 6
	AbortedSKIPPED                  AbortReason = 7
	AbortedNOANALYZE                AbortReason = 8
	AbortedNOBUILD                  AbortReason = 9
	AbortedINCOMPLETE               AbortReason = 10
	AbortedOUTOFMEMORY              AbortReason = 11
)

AbortReason struct set the order explicitly because of ordering mismatches!

func (AbortReason) EnumIndex

func (r AbortReason) EnumIndex() int32

EnumIndex helper method.

func (AbortReason) String

func (r AbortReason) String() string

String Enum helper method.

type ActionCacheStatistics

type ActionCacheStatistics struct {
	SizeInBytes  uint64
	SaveTimeInMs uint64
	LoadTimeInMs int64
	Hits         int32
	Misses       int32
	MissDetails  []MissDetail
}

ActionCacheStatistics struct

type ActionData

type ActionData struct {
	Mnemonic        string
	ActionsExecuted int64
	FirstStartedMs  int64
	LastEndedMs     int64
	SystemTime      int64
	UserTime        int64
}

ActionData struct

type ActionSummary

type ActionSummary struct {
	ActionsCreated                    int64
	ActionsCreatedNotIncludingAspects int64
	ActionsExecuted                   int64
	ActionData                        []ActionData

	RemoteCacheHits       int64
	RunnerCount           []RunnerCount
	ActionCacheStatistics ActionCacheStatistics
}

ActionSummary struct.

type ArtifactMetrics

type ArtifactMetrics struct {
	SourceArtifactsRead            FilesMetric
	OutputArtifactsSeen            FilesMetric
	OutputArtifactsFromActionCache FilesMetric
	TopLevelArtifacts              FilesMetric
}

ArtifactMetrics struct

type BazelCommandLine

type BazelCommandLine struct {
	Command                string
	Executable             string
	Residual               string
	ExplicitCmdLine        []string
	CmdLine                []string
	StartUpOptions         []string
	ExplicitStartupOptions []string
}

BazelCommandLine struct.

type Blob

type Blob struct {
	BlobURI  url.URL
	Size     int
	Contents string
	Name     string
}

Blob holds information about a blob in the CAS. Should be easily converted to/from the one in the cas package. Copied into here so this package does not have *any* dependencies except standard libraries.

type BuildGraphMetrics

type BuildGraphMetrics struct {
	ActionLookupValueCount                    int32
	ActionLookupValueCountNotIncludingAspects int32
	ActionCount                               int32
	InputFileConfiguredTargetCount            int32
	OutputFileConfiguredTargetCount           int32
	OtherConfiguredTargetCount                int32
	OutputArtifactCount                       int32
	PostInvocationSkyframeNodeCount           int32
	DirtiedValues                             []EvaluationStat
	ChangedValues                             []EvaluationStat
	BuiltValues                               []EvaluationStat
	CleanedValues                             []EvaluationStat
	EvaluatedValues                           []EvaluationStat
}

BuildGraphMetrics struct

type CumulativeMetrics

type CumulativeMetrics struct {
	NumAnalyses int32
	NumBuilds   int32
}

CumulativeMetrics struct

type DynamicExecutionMetrics

type DynamicExecutionMetrics struct {
	RaceStatistics []RaceStatistics
}

DynamicExecutionMetrics struct

type EvaluationStat

type EvaluationStat struct {
	SkyfunctionName string
	Count           int64
}

EvaluationStat struct

type ExecutionInfo

type ExecutionInfo struct {
	Strategy        string
	CachedRemotely  bool
	ExitCode        int32
	Hostname        string
	TimingBreakdown TimingBreakdown
	ResourceUsage   []ResourceUsage
}

ExecutionInfo struct

type ExitCode

type ExitCode struct {
	Code int
	Name string
}

ExitCode An Exit Code.

type FilesMetric

type FilesMetric struct {
	SizeInBytes int64
	Count       int32
}

FilesMetric struct

type GarbageMetrics

type GarbageMetrics struct {
	Type             string
	GarbageCollected int64
}

GarbageMetrics struct

type InvocationSummary

type InvocationSummary struct {
	EnvVars          map[string]string
	ExitCode         *ExitCode
	BazelVersion     string
	BazelCommandLine BazelCommandLine
}

InvocationSummary struct.

type MemoryMetrics

type MemoryMetrics struct {
	UsedHeapSizePostBuild          int64
	PeakPostGcHeapSize             int64
	PeakPostGcTenuredSpaceHeapSize int64
	GarbageMetrics                 []GarbageMetrics
}

MemoryMetrics struct

type Metrics

type Metrics struct {
	ActionSummary           ActionSummary
	MemoryMetrics           MemoryMetrics
	TargetMetrics           TargetMetrics
	PackageMetrics          PackageMetrics
	TimingMetrics           TimingMetrics
	CumulativeMetrics       CumulativeMetrics
	ArtifactMetrics         ArtifactMetrics
	BuildGraphMetrics       BuildGraphMetrics
	NetworkMetrics          NetworkMetrics
	DynamicExecutionMetrics DynamicExecutionMetrics
}

Metrics holds Build metrics details This aligngs with data found in the ent schema https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto#L900

type MissDetail

type MissDetail struct {
	Reason MissReason
	Count  int32
}

MissDetail struct

type MissReason

type MissReason int32

MissReason enum.

const (
	MissReasonDIFFERENTACTIONKEY MissReason = iota + 1
	MissReasonDIFFERENTDEPS
	MissReasonDIFFERENTENVIRONMENT
	MissReasonDIFFERENTFILES
	MissReasonCORRUPTEDCACHEENTRY
	MissReasonNOTCACHED
	MissReasonUNCONDITIONALEXECUTION
)

MissReason enum.

func (MissReason) EnumIndex

func (r MissReason) EnumIndex() int32

EnumIndex helper method.

func (MissReason) String

func (r MissReason) String() string

String Enum helper method.

type NamedSetOfFiles

type NamedSetOfFiles struct {
	Files    []TestFile
	FileSets *NamedSetOfFiles
}

NamedSetOfFiles struct

type NetworkMetrics

type NetworkMetrics struct {
	SystemNetworkStats *SystemNetworkStats
}

NetworkMetrics struct

type OutputGroup

type OutputGroup struct {
	Name        string
	Incomplete  bool
	InlineFiles []TestFile
	FileSets    NamedSetOfFiles
}

OutputGroup struct

type PackageLoadMetrics

type PackageLoadMetrics struct {
	Name               string
	LoadDuration       int64
	NumTargets         uint64
	ComputationSteps   uint64
	NumTransitiveLoads uint64
	PackageOverhead    uint64
}

PackageLoadMetrics struct

type PackageMetrics

type PackageMetrics struct {
	PackagesLoaded     int64
	PackageLoadMetrics []PackageLoadMetrics
}

PackageMetrics struct

type RaceStatistics

type RaceStatistics struct {
	Mnemonic     string
	LocalRunner  string
	RemoteRunner string
	LocalWins    int64
	RemoteWins   int64
}

RaceStatistics struct

type ResourceUsage

type ResourceUsage struct {
	Name  string
	Value string
}

ResourceUsage struct

type RunnerCount

type RunnerCount struct {
	Name     string
	Count    int32
	ExecKind string
}

RunnerCount struct

type SourceControlData

type SourceControlData struct {
	RepositoryURL string
	Branch        string
	CommitSHA     string
	Actor         string
	Refs          string
	RunID         string
	Workflow      string
	Action        string
	Workspace     string
	EventName     string
	Job           string
	RunnerName    string
	RunnerArch    string
	RunnerOs      string
}

SourceControlData for an invocation

type Summarizer

type Summarizer struct {
	// contains filtered or unexported fields
}

Summarizer struct.

func NewSummarizer

func NewSummarizer() *Summarizer

NewSummarizer constructor

func (Summarizer) FinishProcessing

func (s Summarizer) FinishProcessing() (*Summary, error)

FinishProcessing function

func (Summarizer) ProcessEvent

func (s Summarizer) ProcessEvent(buildEvent *events.BuildEvent) error

ProcessEvent function

type Summary

type Summary struct {
	*InvocationSummary
	Problems             []detectors.Problem
	RelatedFiles         map[string]string
	EventFileURL         string
	BEPCompleted         bool
	StartedAt            time.Time
	InvocationID         string
	StepLabel            string
	EndedAt              *time.Time
	ChangeNumber         int
	PatchsetNumber       int
	BuildURL             string
	BuildUUID            uuid.UUID
	UserLDAP             string
	UserEmail            string
	BuildLogs            strings.Builder
	Metrics              Metrics
	Tests                map[string]TestsCollection
	Targets              map[string]TargetPair
	NumFetches           int64
	CPU                  string
	PlatformName         string
	Hostname             string
	IsCiWorker           bool
	ProfileName          string
	ConfigrationMnemonic string
	SkipTargetData       bool
	EnrichTargetData     bool
	SourceControlData    SourceControlData
}

Summary The Invocation Summary object holds details about an invocation.

func Summarize

func Summarize(ctx context.Context, eventFileURL string) (*Summary, error)

Summarize function.

type SystemNetworkStats

type SystemNetworkStats struct {
	BytesSent             uint64
	BytesRecv             uint64
	PacketsSent           uint64
	PacketsRecv           uint64
	PeakBytesSentPerSec   uint64
	PeakBytesRecvPerSec   uint64
	PeakPacketsSentPerSec uint64
	PeakPacketsRecvPerSec uint64
}

SystemNetworkStats struct

type TargetComplete

type TargetComplete struct {
	Success            bool
	TargetKind         string
	TestSize           TestSize
	OutputGroup        OutputGroup
	ImportantOutput    []TestFile
	DirectoryOutput    []TestFile
	Tag                []string
	TestTimeoutSeconds int64
	TestTimeout        int64
	// adding this to track time
	// not ideal, TODO: can we somehow get a more accurate measure for this data
	EndTimeInMs int64
}

TargetComplete struct

type TargetConfigured

type TargetConfigured struct {
	Tag        []string
	TargetKind string
	TestSize   TestSize

	// adding this to track time for a target
	// not ideal, TODO: can we somehow get a more accurate measure for this data
	StartTimeInMs int64
}

TargetConfigured struct

type TargetMetrics

type TargetMetrics struct {
	TargetsLoaded                        int64
	TargetsConfigured                    int64
	TargetsConfiguredNotIncludingAspects int64
}

TargetMetrics struct

type TargetPair

type TargetPair struct {
	Configuration TargetConfigured
	Completion    TargetComplete
	DurationInMs  int64
	Success       bool
	TargetKind    string
	TestSize      TestSize
	AbortReason   AbortReason
}

TargetPair struct summary object for a target.

type TestFile

type TestFile struct {
	Digest string
	File   string
	Length int64
	Name   string
	Prefix []string
}

TestFile struct

type TestResult

type TestResult struct {
	Status              TestStatus
	StatusDetails       string
	Label               string
	Warning             []string
	CachedLocally       bool
	TestAttemptDuration int64
	TestAttemptStart    string // timestamp
	TestActionOutput    []TestFile
	ExecutionInfo       ExecutionInfo
}

TestResult struct

type TestSize

type TestSize int32

TestSize Enum.

const (
	UNKNOWN  TestSize = iota + 1 //nolint
	SMALL                        //nolint
	MEDIUM                       //nolint
	LARGE                        //nolint
	ENORMOUS                     //nolint
)

TestSize enum.

func (TestSize) EnumIndex

func (r TestSize) EnumIndex() int32

EnumIndex Enum helper method.

func (TestSize) String

func (r TestSize) String() string

Enum helper method.

type TestStatus

type TestStatus int32

TestStatus ENUM.

const (
	TestStatuNOSTATUS TestStatus = iota + 1
	TestStatuPASSED
	TestStatuFLAKY
	TestStatuTIMEOUT
	TestStatuFAILED
	TestStatuINCOMPLETE
	TestStatuREMOTEFAILURE
	TestStatuFAILEDTOBUILD
	TestStatuTOOLHALTEDBEFORETESTING
)

TestStatus enum.

func (TestStatus) EnumIndex

func (r TestStatus) EnumIndex() int32

EnumIndex helper method.

func (TestStatus) String

func (r TestStatus) String() string

String Enum helper method.

type TestSummary

type TestSummary struct {
	Label            string
	Status           TestStatus
	TotalRunCount    int32
	RunCount         int32
	AttemptCount     int32
	ShardCount       int32
	TotalNumCached   int32
	FirstStartTime   int64
	LastStopTime     int64
	TotalRunDuration int64
	Passed           []TestFile
	Failed           []TestFile
}

TestSummary struct

type TestsCollection

type TestsCollection struct {
	TestSummary    TestSummary
	TestResults    []TestResult
	OverallStatus  TestStatus
	Strategy       string
	CachedLocally  bool
	CachedRemotely bool
	DurationMs     int64
	FirstSeen      time.Time
}

TestsCollection struct summary object for a test.

type TimingBreakdown

type TimingBreakdown struct {
	Name  string
	Time  string
	Child []TimingChild
}

TimingBreakdown struct

type TimingChild

type TimingChild struct {
	Name string
	Time string
}

TimingChild struct

type TimingMetrics

type TimingMetrics struct {
	CPUTimeInMs            int64
	WallTimeInMs           int64
	AnalysisPhaseTimeInMs  int64
	ExecutionPhaseTimeInMs int64
}

TimingMetrics struct

Directories

Path Synopsis
Package detectors contains components for detecting Problems in an event stream.
Package detectors contains components for detecting Problems in an event stream.

Jump to

Keyboard shortcuts

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