Documentation
¶
Overview ¶
Package summary provides types and utility methods for the end-of-test summary.
Index ¶
Constants ¶
const ( ModeCompact = Mode(iota) // Compact mode that only displays the total results. ModeFull // Extended mode that displays total and partial results. ModeLegacy // Deprecated. Legacy mode, used for backwards compatibility. ModeDisabled // Disabled, formerly known as --no-summary. )
Possible values for SummaryMode.
Variables ¶
var ErrInvalidSummaryMode = errors.New("invalid summary mode")
ErrInvalidSummaryMode indicates the serialized summary mode is invalid.
Functions ¶
func ToMachineReadable ¶
func ToMachineReadable(s *Summary, meta Meta) (machinereadable.Summary, error)
ToMachineReadable takes a Summary and Meta and builds a machine-readable summary machinereadable.Summary from them.
Types ¶
type Checks ¶
type Checks struct {
Metrics ChecksMetrics
OrderedChecks []*Check
}
Checks holds the checks to be rendered in the summary.
type ChecksMetrics ¶
type ChecksMetrics struct {
Total Metric `js:"checks_total"`
Success Metric `js:"checks_succeeded"`
Fail Metric `js:"checks_failed"`
}
ChecksMetrics is the subset of checks-specific metrics.
type Group ¶
type Group struct {
Checks *Checks // Not always present, thus we use a pointer.
Metrics Metrics
Groups map[string]Group
GroupsOrder []string // Groups names with the order to be displayed in the summary. Typically same as in code.
}
Group is a group of metrics and subgroups (recursive) that will be rendered in the summary.
type Meta ¶
Meta holds some metadata associated with the Summary but isn't strictly part of it, like the script.
type Metric ¶
type Metric struct {
MetricInfo
Values map[string]float64
}
Metric holds all the information needed to display a metric in the summary, including its definition and its values.
func NewMetricFrom ¶
func NewMetricFrom(info MetricInfo, values map[string]float64) Metric
NewMetricFrom instantiates a new Metric for a given metrics.Sink and the metric's info.
type MetricInfo ¶
MetricInfo holds the definition of a metric that will be rendered in the summary, including the name of the metric, its type (Counter, Trend, etc.) and what contains (data amounts, times, etc.).
type MetricThresholds ¶
type MetricThresholds struct {
Metric Metric `js:"metric"`
Thresholds []Threshold `js:"thresholds"`
}
MetricThresholds is the collection of Threshold that belongs to the same metric.
type Metrics ¶
type Metrics struct {
// HTTP contains summary data specific to HTTP metrics and is used
// to produce the summary HTTP subsection's content.
HTTP map[string]Metric
// Execution contains summary data specific to Execution metrics and is used
// to produce the summary Execution subsection's content.
Execution map[string]Metric
// Network contains summary data specific to Network metrics and is used
// to produce the summary Network subsection's content.
Network map[string]Metric
Browser map[string]Metric
WebVitals map[string]Metric
Grpc map[string]Metric
WebSocket map[string]Metric `js:"websocket"`
// Custom contains user-defined metric results as well as extensions metrics
Custom map[string]Metric
}
Metrics is a collection of Metric grouped by section (http, network, etc).
type Mode ¶
type Mode int
A Mode specifies the mode of the Summary, which defines how the end-of-test summary will be rendered. TODO(@joanlopez): remove ModeLegacy by k6 v2.0, once we completely drop the support for --summary-mode=legacy.
func ValidateMode ¶
ValidateMode checks if the provided val is a valid Mode.
func (Mode) MarshalJSON ¶
MarshalJSON serializes a Mode as a human-readable string.
func (Mode) MarshalText ¶
MarshalText serializes a Mode as a human-readable string.
func (*Mode) UnmarshalText ¶
UnmarshalText deserializes a Mode from a string representation.
type Summary ¶
type Summary struct {
Thresholds `js:"thresholds"`
Group `js:"root_group"`
Scenarios map[string]Group
TestRunDuration time.Duration
NoColor bool // TODO: drop this when noColor is part of the (runtime) options
EnableColors bool
NewMachineReadableSummary bool
}
Summary is the data structure that holds all the summary data (thresholds, metrics, checks, etc) as well as some other information, like certain rendering options.
type Thresholds ¶
type Thresholds map[string]MetricThresholds
Thresholds is a collection of MetricThresholds that will be rendered in the summary.
func NewThresholds ¶
func NewThresholds() Thresholds
NewThresholds instantiates an empty collection of Thresholds.