Documentation
¶
Overview ¶
Package report implements FR-RPT-01 through 04 and FR-CLI-05: turning a run's recorded iterations into the structured data a self-contained HTML report, a JSON summary, and (eventually) the MCP get_results tool all read from. It implements engine.Recorder, exactly the seam internal/engine's own doc comment on Recorder sets aside for it, and knows nothing about protocols, scripting, or the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteHTML ¶
WriteHTML implements FR-RPT-01: one self-contained HTML file for res, with no server and nothing fetched at render time — every number is inlined, and the two charts are hand-drawn inline SVG (see the artifact-diagramming conventions this follows: currentColor strokes so the report reads in both light and dark browser themes, a viewBox sized to the content, labelled axes instead of a legend). The file opens correctly from disk with no network access at all, which is what "self-contained" means for FR-RPT-03's offline-renderable guarantee.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector implements engine.Recorder, accumulating every iteration of a run so Finish can compute the percentiles and time-bucketed series a Result needs. It is safe for concurrent use — Run calls Record from every VU goroutine at once.
func NewCollector ¶
func NewCollector() *Collector
NewCollector returns a Collector ready to record a run that is starting now.
func (*Collector) Counts ¶
Counts returns the total and failed iteration counts recorded so far. Safe to call concurrently with Record, including while the run it belongs to is still in progress.
func (*Collector) Finish ¶
Finish computes a Result from every sample recorded so far. Call it once, after the executor has returned; executor identifies the load shape (ex.Name()) and elapsed is the run's measured wall-clock time, both of which the caller already has from runScenario.
func (*Collector) Record ¶
func (c *Collector) Record(r engine.IterationResult)
Record implements engine.Recorder.
type Latency ¶
type Latency struct {
Min time.Duration `json:"min_ns"`
Mean time.Duration `json:"mean_ns"`
Max time.Duration `json:"max_ns"`
P50 time.Duration `json:"p50_ns"`
P90 time.Duration `json:"p90_ns"`
P95 time.Duration `json:"p95_ns"`
P99 time.Duration `json:"p99_ns"`
}
Latency holds the percentiles and summary stats FR-RPT-01 asks for.
type Point ¶
type Point struct {
Offset time.Duration `json:"offset_ns"`
Requests int64 `json:"requests"`
Failed int64 `json:"failed"`
RPS float64 `json:"rps"`
ErrorRate float64 `json:"error_rate"`
}
Point is one bucket of Result.TimeSeries.
type Result ¶
type Result struct {
Executor string `json:"executor"`
StartedAt time.Time `json:"started_at"`
Elapsed time.Duration `json:"elapsed_ns"`
Total int64 `json:"total"`
Failed int64 `json:"failed"`
ErrorRate float64 `json:"error_rate"`
Latency Latency `json:"latency"`
// TimeSeries is RPS and error rate bucketed by one-second intervals
// from the run's start (FR-RPT-01's "RPS over time" and "error rate
// over time"). It stays small regardless of request volume — one
// point per second of run duration, not one per request — which is
// what lets the HTML report embed it directly even for a
// 1,000,000-request run (NFR-03).
TimeSeries []Point `json:"time_series"`
}
Result is a run's structured outcome: everything the HTML report renders, and the same shape FR-RPT-04 says the MCP get_results tool (Phase 2) must return, so an agent host can render its own view from exactly the same data a human reads in the HTML report.