pgwriter

package
v0.0.0-...-2356e84 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CarryForwardCumulativeSummaries

func CarryForwardCumulativeSummaries(ctx context.Context, dbc *db.DB, currentDate civil.Date, releases []string) error

CarryForwardCumulativeSummaries fills any gap days between the latest existing cumulative summary data and currentDate+1 (tomorrow) for each release. If the loader was down for multiple days, this catches up all missed days. Subsequent calls for the same date range are no-ops. Releases are processed in parallel with up to 4 workers.

func Write

func Write(ctx context.Context, dbc *db.DB, currentDate civil.Date, batch []JobRunResult) error

Write persists a batch of job run results to the database within a single transaction. It creates temp tables, copies raw rows via the COPY protocol, then INSERTs/UPSERTs into permanent tables including tests, suites, prow_job_run_tests, test_daily_totals, and test_cumulative_summaries.

Types

type AnnotationRow

type AnnotationRow struct {
	ProwJobRunID        uint
	Key                 string
	Value               string
	ProwJobRunRelease   string
	ProwJobRunTimestamp time.Time
}

AnnotationRow holds a key-value annotation for a prow job run.

type JobRunResult

type JobRunResult struct {
	Run              RunRow
	Annotations      []AnnotationRow
	PullRequests     []PullRequestRow
	PullRequestAssoc []PullRequestAssocRow
	Tests            []TestRow
}

JobRunResult aggregates all rows produced by processing a single prow job run.

type PullRequestAssocRow

type PullRequestAssocRow struct {
	ProwJobRunID        uint
	Link                string
	SHA                 string
	ProwJobRunRelease   string
	ProwJobRunTimestamp time.Time
}

PullRequestAssocRow links a prow job run to a pull request.

type PullRequestRow

type PullRequestRow struct {
	Org      string
	Repo     string
	Link     string
	SHA      string
	Author   string
	Title    string
	Number   int
	MergedAt *time.Time
}

PullRequestRow holds pull request metadata to be upserted.

type RunRow

type RunRow struct {
	ID             uint
	Cluster        string
	Duration       time.Duration
	ProwJobID      uint
	ProwJobRelease string
	URL            string
	GCSBucket      string
	Timestamp      time.Time
	OverallResult  sippyprocessingv1.JobOverallResult
	TestFailures   int
	TestFlakes     int
	Succeeded      bool
	Labels         []string
}

RunRow holds a single prow job run to be persisted.

type TestRow

type TestRow struct {
	ProwJobRunID        uint
	ProwJobID           uint
	ProwJobRunTimestamp time.Time
	ProwJobRunRelease   string
	TestName            string
	SuiteName           string
	Status              int
	Duration            float64
	Output              *string
	Lifecycle           string
}

TestRow holds raw JUnit test data before ID resolution.

Jump to

Keyboard shortcuts

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