loadgen

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package loadgen generates deterministic synthetic Finding, FindingRollup, and Investigation resources for benchmarks and load tests. The same (index, Opts) pair always yields byte-identical objects, so benchmark datasets are reproducible across runs and machines, and a scanner-side alert built by SourceFinding folds into the Finding built by the same index — the label hash follows the exact accumulation-key recipe the ingester persists.

TEST-ONLY: this package is imported only from _test.go files. It must never be imported by product code — its objects fabricate status fields that production components own exclusively.

Index

Constants

View Source
const (
	// IntegrationName is the ingesting Integration every finding references.
	IntegrationName = "loadgen"
	// SourceID is the source handler id on every finding.
	SourceID = "loadgen-scanner"
	// Namespace the generated objects live in.
	Namespace = "patchy"
)

Fixed identities every generated object shares. The integration name enters the accumulation key, so a bench pairing SourceFinding with an Integration CR must name the CR IntegrationName.

Variables

This section is empty.

Functions

func Finding

func Finding(i int, o Opts) *v1alpha1.Finding

Finding builds index i's Finding, shaped like a real ingested one: the accumulation labels carry genuine hash values, alerts carry locations and snippets, and status matches the picked phase.

func FindingName

func FindingName(i int, o Opts) string

FindingName is index i's deterministic object name (generation 1).

func Findings

func Findings(n int, o Opts) []v1alpha1.Finding

Findings builds n findings for indices [0, n).

func Investigations

func Investigations(n int, o Opts) []v1alpha1.Investigation

Investigations builds n Investigation children; child i belongs to Finding(i, o) and carries a completed stage result.

func KeyHash

func KeyHash(i int, o Opts) string

KeyHash is the accumulation-key label value for index i: the exact recipe internal/controller/integration persists (5-byte-hex sha256 over integration|source|scope|advisory).

func RepoURL

func RepoURL(i int, o Opts) string

RepoURL is index i's repository URL (i modulo the repo cardinality).

func Rollups

func Rollups(n int) []v1alpha1.FindingRollup

Rollups builds n FindingRollup objects: index 0 is the total scope, the rest are repository scopes, each with a populated bucket, monthly trend, and a full 512-entry ledger — the shape a long-lived deployment carries.

func SourceFinding

func SourceFinding(i, alert int, o Opts) source.Finding

SourceFinding builds the scanner-side alert whose accumulation key matches Finding(i, o) — ingesting it against an Integration named IntegrationName folds into that family. alert distinguishes deliveries within the family.

Types

type Opts

type Opts struct {
	// AlertsPerFinding is the alert count folded into each finding
	// (default 1, capped at the CRD's 64).
	AlertsPerFinding int
	// PhaseMix weights the phase distribution; nil means every finding is
	// Opened. Terminal phases get a CompletedAt stamp.
	PhaseMix map[v1alpha1.Phase]int
	// RepoCardinality is the number of distinct repositories findings spread
	// over (default 100).
	RepoCardinality int
	// Seed varies the whole dataset; the default 0 is a valid seed.
	Seed uint64
}

Opts shape a synthetic dataset. The zero value is usable.

Jump to

Keyboard shortcuts

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