diagnose

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package diagnose implements the rule-based half of FR-MCP-05's diagnose_failure / vegaload diagnose: a set of fixed heuristics over a report.Result that flag the failure patterns a human reviewing a load test would look for first, plus a pure-arithmetic threshold suggester. It knows nothing about the CLI, MCP, or any LLM — internal/llm's narrative connector is a separate, optional layer that takes these Findings as input (see cmd/vegaload/diagnose.go for how the two combine).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	OffsetSeconds float64 `json:"offset_seconds"`
	ErrorRate     float64 `json:"error_rate"`
	Requests      int64   `json:"requests"`
	Failed        int64   `json:"failed"`
}

Bucket identifies the single worst time-series point by error rate, letting a caller point at *when* a run went bad rather than just that it did.

type Findings

type Findings struct {
	ZeroIterations  bool     `json:"zero_iterations"`
	FailurePercent  float64  `json:"failure_percent"`
	HighFailureRate bool     `json:"high_failure_rate"` // > 50%
	LatencyLongTail bool     `json:"latency_long_tail"` // p99 > 5x p50
	WorstBucket     *Bucket  `json:"worst_bucket,omitempty"`
	Transient       bool     `json:"transient,omitempty"` // failures concentrated in one bucket vs. spread out
	Notes           []string `json:"notes"`
}

Findings is the rule-based diagnosis of a single report.Result: a set of independently-triggered observations, each already phrased as a sentence a report or MCP tool response can show verbatim.

func Analyze

func Analyze(res *report.Result) Findings

Analyze runs every heuristic against res and returns the findings that triggered, each with a human-readable note appended to Notes. It never returns an error: an empty or all-successful Result simply yields Findings with nothing set and a single reassuring note.

type Thresholds

type Thresholds struct {
	LatencyP95 string  `json:"latency_p95"`
	ErrorRate  float64 `json:"error_rate"`
}

Thresholds is the output of SuggestThresholds: pass/fail criteria a future run of the same scenario could be gated on, derived from this run's own observed performance.

func SuggestThresholds

func SuggestThresholds(res *report.Result) Thresholds

SuggestThresholds derives conservative pass/fail thresholds from a clean baseline run: p95 latency headroom'd by 20% and rounded to the nearest 10ms (so the suggestion reads as a round number, not a spurious-precision artifact of one run), and an error-rate ceiling of 1.5x what was observed, floored at 1% so a zero-failure baseline still yields a usable, nonzero threshold.

Jump to

Keyboard shortcuts

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