report

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package report renders a finished run as a single self-contained HTML file.

The file has no scripts, no external stylesheet, no web font and no network dependency of any kind: the charts are inline SVG and the styling is inline CSS. That is the whole point. A load-test result gets attached to a ticket, mailed to somebody, or opened two years later to settle an argument about when a regression started, and any of those uses is defeated by a file that needs a CDN to render.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filename

func Filename(run coordinator.Summary) string

Filename suggests a name for the downloaded file.

func Render

func Render(w io.Writer, data Data) error

Render writes the report as HTML.

Types

type Chart

type Chart struct {
	Title  string
	Hint   string
	X      []time.Time
	Series []Series
	// Format renders a Y value for the axis and the legend.
	Format func(float64) string
	// Stacked draws the series as cumulative bands rather than lines.
	Stacked bool
}

Chart is a time series rendered as standalone SVG.

Everything is inline — no script, no external stylesheet, no web font — so the report stays readable years later, offline, attached to a ticket.

func (Chart) Empty

func (c Chart) Empty() bool

Empty reports whether there is anything to draw.

func (Chart) Legend

func (c Chart) Legend() []LegendEntry

Legend returns the series with their final values.

The value beside each swatch is what keeps identity off colour alone, which matters more in a printed or forwarded report than on screen.

func (Chart) SVG

func (c Chart) SVG() template.HTML

SVG renders the chart.

type Data

type Data struct {
	Run         coordinator.Summary
	Generated   time.Time
	Version     string
	Verdict     Verdict
	Totals      map[string]metrics.SeriesSummary
	Headline    []Stat
	Charts      []Chart
	Endpoints   []metrics.EndpointSummary
	Failures    []metrics.FailureSummary
	Thresholds  []coordinator.ThresholdResult
	Agents      []coordinator.AgentInfo
	Events      []coordinator.Event
	Warnings    []string
	OmittedEnds int
}

Data is everything the template renders.

func Build

func Build(snapshot coordinator.Snapshot, now time.Time) (Data, error)

Build assembles a report from a coordinator snapshot.

type LegendEntry

type LegendEntry struct {
	Label string
	Color string
	Value string
}

LegendEntry is one row of a chart's legend.

type Series

type Series struct {
	Label string
	Color string
	// Points are aligned with the chart's X values.
	Points []float64
	// Fill draws a translucent area beneath the line. Single-series charts
	// use it; a multi-series chart would be unreadable with eight of them.
	Fill bool
}

Series is one line on a chart.

type Stat

type Stat struct {
	Label  string
	Value  string
	Detail string
}

Stat is one headline figure.

type Verdict

type Verdict struct {
	// Passed is true only when the run completed and no threshold breached.
	Passed bool
	// Label is the short word shown in the banner.
	Label string
	// Detail explains it in a sentence.
	Detail string
}

Verdict is the report's headline judgement.

Jump to

Keyboard shortcuts

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