Documentation
¶
Overview ¶
Package preprocess provides filters and transformations for workflow run data that must be applied before any statistical analysis.
Index ¶
- Constants
- func ComputeRerunStats(details []model.RunDetail) map[int64]RerunStats
- func DeduplicateRetries(details []model.RunDetail) []model.RunDetail
- func ExcludeFailures(details []model.RunDetail) []model.RunDetail
- func ExcludeRerunAttempts(details []model.RunDetail) []model.RunDetail
- func FilterByBranch(details []model.RunDetail, branch string) []model.RunDetail
- func FilterByEventCategory(details []model.RunDetail, category string) []model.RunDetail
- func ParseMatrixJobName(name string) (base, variant string)
- func Run(details []model.RunDetail, opts Options) (result []model.RunDetail, warnings []diag.Diagnostic)
- type Options
- type RerunStats
Constants ¶
const ( CategoryPR = "pr" CategoryMain = "main" CategoryAll = "all" )
Run trigger categories for FilterByEventCategory — the shared vocabulary of the app layer's BranchCategory option and the CLI's --branch-category flag.
Variables ¶
This section is empty.
Functions ¶
func ComputeRerunStats ¶
func ComputeRerunStats(details []model.RunDetail) map[int64]RerunStats
ComputeRerunStats computes per-workflow retry statistics from unfiltered data. Must be called before DeduplicateRetries. Returns only workflows that had at least one retry.
func DeduplicateRetries ¶
DeduplicateRetries keeps only the latest attempt for each run ID. GitHub Actions creates new run_attempt numbers for re-runs but keeps the same run ID.
func ExcludeFailures ¶
ExcludeFailures keeps only runs with conclusion "success".
func ExcludeRerunAttempts ¶ added in v0.27.0
ExcludeRerunAttempts keeps only first attempts.
func FilterByBranch ¶
FilterByBranch keeps only runs from the specified branch.
func FilterByEventCategory ¶ added in v0.27.0
FilterByEventCategory selects runs by trigger category: CategoryPR keeps pull_request-event runs, CategoryMain keeps everything else (pushes, schedules, manual dispatches — the default-branch style of traffic).
func ParseMatrixJobName ¶
ParseMatrixJobName splits a job name like "test (ubuntu-latest, 20)" into base="test" and variant="ubuntu-latest, 20". If there are no parentheses, variant is empty.
Types ¶
type Options ¶
type Options struct {
Branch string // filter to this branch (empty = no filter)
IncludeFailures bool // if false, exclude non-success conclusions
}
Options controls which preprocessing steps are applied.
type RerunStats ¶
type RerunStats struct {
UniqueRuns int // distinct run IDs
RetriedRuns int // runs with more than 1 attempt
ExtraAttempts int // total extra attempts (sum of max_attempt - 1 per retried run)
RerunRate float64 // fraction of unique runs that were retried
}
RerunStats holds retry statistics for a workflow.