buildgolang.org/x/build/internal/buildstats Index | Files

package buildstats

import "golang.org/x/build/internal/buildstats"

Package buildstats contains code to sync the coordinator's build logs from Datastore to BigQuery.

Index

Variables

var Verbose = false

Verbose controls logging verbosity.

Functions

func SyncBuilds

func SyncBuilds(ctx context.Context, env *buildenv.Environment) error

SyncBuilds syncs the datastore "Build" entities to the BigQuery "Builds" table. This stores information on each build as a whole, without details.

func SyncSpans

func SyncSpans(ctx context.Context, env *buildenv.Environment) error

SyncSpans syncs the datastore "Span" entities to the BigQuery "Spans" table. These contain the fine-grained timing details of how a build ran.

Types

type BuilderTestStats

type BuilderTestStats struct {
	// Builder is which build configuration this is for.
	Builder string

	// Runs is how many times tests have run recently, for some
	// fuzzy definition of "recently".
	// The map key is a cmd/dist test name.
	Runs map[string]int

	// MedianDuration is the median duration for a test to
	// pass on this BuilderTestStat's Builder.
	// The map key is a cmd/dist test name.
	MedianDuration map[string]time.Duration
}

func (*BuilderTestStats) Tests

func (ts *BuilderTestStats) Tests() []string

type TestStats

type TestStats struct {
	// AsOf is the time that the stats were queried from BigQuery.
	AsOf time.Time

	// BuilderTestStats maps from a builder name to that builder's
	// test stats.
	BuilderTestStats map[string]*BuilderTestStats
}

TestStats describes stats for a cmd/dist test on a particular build configuration (a "builder").

func QueryTestStats

func QueryTestStats(ctx context.Context, env *buildenv.Environment) (*TestStats, error)

QueryTestStats returns stats on all tests for all builders.

func (*TestStats) Builders

func (ts *TestStats) Builders() []string

func (*TestStats) Duration

func (ts *TestStats) Duration(builder, testName string) time.Duration

Duration returns the median time to run testName on builder, if known. Otherwise it returns some non-zero default value.

Source Files

buildstats.go sync.go

Version
v0.0.0-20250421191922-3619c213cff3 (latest)
Published
Apr 21, 2025
Platform
linux/amd64
Imports
13 packages
Last checked
3 months ago

Tools for package owners.