k6

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package k6 parses the raw k6 summary that benchmarks/workloads/crud-list.js dumps (via handleSummary) into the load-generator-derived fields of a benchmark result. The workload does no interpretation — it forwards k6's own metrics and state — so every mapping that used to be a footgun in JavaScript (the http_req_failed Rate whose FAILED count is `passes` not `fails`, the percentile keys, the elapsed run time) lives here and is unit-tested against captured k6 goldens (testdata/).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Summary

type Summary struct {
	Requests          int64
	RequestsPerSecond float64
	LatencyMs         result.Latency
	Errors            int64
	ChecksFailed      int64
	DurationSeconds   float64
}

Summary is the interpreted, load-generator-measured half of a result row. The orchestrator fills in the identity/config fields (framework, concurrency, trial, ...) around it via Merge. DurationSeconds is the ACTUAL elapsed measured window (from k6's state), not the requested flag.

func ParseSummary

func ParseSummary(r io.Reader) (Summary, error)

ParseSummary decodes and interprets one raw k6 summary. Decoding/mapping only — validity is Validate's job, so a caller can inspect a failed run's numbers before rejecting it.

func (Summary) Merge

func (s Summary) Merge(base result.Result) result.Result

Merge copies the load-generator-measured fields of s onto base (which carries the identity/config fields the orchestrator set), including the actual measured DurationSeconds, and returns the completed result row.

func (Summary) Validate

func (s Summary) Validate() error

Validate rejects a trial that isn't a clean measurement: no traffic at all (target unreachable / workload misconfigured), any HTTP error (the target erroring or unreachable — every request failing still yields requests > 0), or any failed content check (a 200 with the wrong page shape). The headline read workload against a healthy, seeded app must be error-free; the orchestrator turns a Validate failure into a loud benchmark failure rather than recording a bogus row (issue #141 §10 "a failed implementation must make the benchmark command fail clearly", §7 "instead of publishing bogus data").

Jump to

Keyboard shortcuts

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