compare

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package compare diffs two report.Result values (typically JSON from `vegaload run -out`) so a later run can be checked against a baseline without a baseline registry or history store — just two files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric struct {
	Name      string  `json:"name"`
	Baseline  float64 `json:"baseline"`
	Candidate float64 `json:"candidate"`
	Delta     float64 `json:"delta"` // candidate - baseline
	Unit      string  `json:"unit"`  // "ratio", "ns", "rps", "count"
	Regressed bool    `json:"regressed"`
}

Metric is one compared field: baseline vs candidate, with a delta and whether that field alone counts as a regression under Options.

type Options

type Options struct {
	// ErrorRateDelta is absolute slack on error rate (0.01 = one
	// percentage point). Candidate may exceed baseline by this much
	// without counting as a regression.
	ErrorRateDelta float64
	// P95Ratio is the maximum allowed candidate/baseline p95 ratio.
	// 1.0 means any p95 increase is a regression; 1.2 allows 20% headroom.
	// Values below 1.0 are treated as 1.0.
	P95Ratio float64
}

Options tunes what counts as a regression. Zero values mean strict compare: any increase in error rate or p95 latency is a regression.

type Result

type Result struct {
	BaselinePath  string   `json:"baseline_path,omitempty"`
	CandidatePath string   `json:"candidate_path,omitempty"`
	Metrics       []Metric `json:"metrics"`
	Regressed     bool     `json:"regressed"`
	Notes         []string `json:"notes"`
}

Result is the structured outcome of Compare — the same shape printed as text or JSON by `vegaload compare`, and returned by the MCP compare_reports tool.

func Compare

func Compare(baseline, candidate *report.Result, opts Options) Result

Compare diffs candidate against baseline. Paths are optional labels filled in by the CLI; the comparison itself is purely numeric.

Jump to

Keyboard shortcuts

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