Documentation
¶
Overview ¶
Package report reads a finished load-test run.
It is glue over github.com/galax-io/parsec plus one counting pass: it finds the run, opens its log whatever version wrote it, and walks the stream once to count what the log holds. It computes no statistic and writes no data format, and it declares no type for anything parsec already defines — the position of a sample, the bounds of a run, the outcome recorded, an optional value, and what a source can never record are all parsec's own.
The statistics of galaxio-cli#51 and the stats.json writer of galaxio-cli#52 fold over this same pass.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoPath error = noPath{}
ErrNoPath refuses an argument that was given but is empty. The zero value of every configuration field and every unset shell variable is the empty string, and guessing a results root for one would answer confidently about a run nobody asked for.
It wraps parsec's refusal of the same thing rather than restating it, so that errors.Is against run.ErrNoPath holds for what this package returns. The wording is this command's, because it can say the one thing a library cannot: that omitting the argument is how the default root is asked for.
var ErrSpent = errors.New("the run has already been read: a reader yields its items once")
ErrSpent refuses a second walk over a run that has already been read.
Functions ¶
func Locate ¶
Locate finds the run to read. An empty path means the results root Maven and sbt write to, resolved against the working directory; anything else is handed to parsec unchanged: a run directory or its simulation.log is the run, and any other directory is a results root searched by lastRun.txt, then by the most recently modified run.
A path the caller named that does not exist, or that exists and is not a directory, is reported as what it is, never as an absence of runs: those are different things and the wrong one sends a caller to debug a place rather than a spelling. The default root is not treated that way: the caller never typed it, so "no run under target/gatling" is the honest answer for a project that has not run a load test.
Types ¶
type Source ¶
type Source struct {
Format gatling.Format
Reader simlog.RunReader
// contains filtered or unexported fields
}
Source is an open run: the log format it holds and the reader that yields its items. Close it when the read is over.
func Open ¶
Open opens the run at loc. The format is identified from the log's leading bytes, never from its name, and parsec applies its own version gate; a refusal comes back naming the log.
The accepted version range is parsec's own. Nothing here narrows or widens it, so the error for an unsupported version quotes the range in force.
func (*Source) Close ¶
Close releases the log file, and spends the source: the reader over a closed file answers from its latched end rather than failing, so a walk afterwards would look like a run that recorded nothing.
func (*Source) Scan ¶
Scan walks the run once, and refuses to walk it again.
A reader yields its items once: both codecs latch their end and answer every later call with it, so a second pass returns a tally of nothing and no error — which is exactly what a run that recorded nothing returns, and no caller could tell the two apart. A closed source is the same: the latched end means the file is never touched, so reading one succeeds too.
This matters ahead of its time. The statistics of galaxio-cli#51 and the stats.json writer of galaxio-cli#52 fold over this same pass, and the first caller to fold twice would have shipped a report of zero requests for a full run and exited 0.
type Tally ¶
type Tally struct {
// Requests is every sample walked; Successes, Failures and Unknown sum to
// it. Unknown counts a sample whose outcome the source lost, which is
// neither a success nor a failure and must not be silently made either.
Requests int
Successes int
Failures int
Unknown int
// Groups counts group traversals and Users virtual-user events, not
// distinct groups or virtual users: a run emits one traversal per entry
// and a start and an end per user.
Groups int
Users int
Errors int
// Assertions counts declared-assertion payloads a source yielded among its
// events rather than ahead of them. Gatling writes its own before the
// events, where they land on the run description instead, so this is zero
// for a Gatling log — but a payload that does arrive here must be counted
// rather than walked past in silence.
Assertions int
// Other counts items of a kind this package does not know, which a later
// parsec release could introduce. Nothing can be said about them except
// that they were there, and saying nothing at all would under-report the
// log.
Other int
// Bounds is where the run begins and ends, as parsec defines it. It may
// report nothing when an item could not be placed in time.
Bounds model.Bounds
}
Tally is what one pass over a run counted, beside the bounds parsec derives from the same pass.
These are counts of records walked, not statistics: nothing here is a mean, a percentile, a range or a rate. Successes and failures are kept apart from the outcome the source recorded so that the statistics of galaxio-cli#51 inherit a split that was never conflated.
func Scan ¶
Scan walks the run rd yields once, counting what it holds and extending the run's bounds. Nothing is retained, so memory does not grow with the log.
A log cut short — a run killed mid-flight — returns the tally of everything it did hold together with an error, because a partial run must not be mistaken for a complete one. One shape cannot be detected: a run killed exactly on a record boundary leaves a log neither format carries an end marker for, so parsec ends it with io.EOF and this reports it as complete. The format cannot express the difference and neither can this. Any other read failure returns the tally walked so far and an error saying the run was not read completely. A cancelled ctx returns its error.
rd must not have been walked already. A reader yields its items once, so a second walk returns an empty tally and no error, which no caller can tell from a run that recorded nothing. Source.Scan holds that precondition for the open runs this package hands out; a caller holding a bare reader owns it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package reporttest builds synthetic Gatling logs for tests and benchmarks.
|
Package reporttest builds synthetic Gatling logs for tests and benchmarks. |