Class BowireBenchmarkThreshold

Namespace
Kuestenlogik.Bowire.Benchmarking
Assembly
Kuestenlogik.Bowire.Benchmarking.dll

A latency / error / throughput budget a benchmark run must satisfy (#360) — k6's threshold concept, expressed the same way flow expectations are, so an operator learns one grammar.

Written as metric operator budget: p95 < 200, error-rate < 0.01, throughput >= 50. Whitespace is optional and k6's own p(95) spelling parses too, so a budget copied out of a k6 script keeps working.

public sealed class BowireBenchmarkThreshold
Inheritance
BowireBenchmarkThreshold
Inherited Members

Properties

Aggregation

#621 — which aggregation of ResponseMetric is compared.

public BowireMetricAggregation Aggregation { get; }

Property Value

BowireMetricAggregation

AppliesToHold

#624 — whether a connection hold can evaluate this threshold: its own metrics and time to first chunk.

public bool AppliesToHold { get; }

Property Value

bool

Budget

The budget itself — milliseconds, a 0..1 rate, or calls/second.

public double Budget { get; }

Property Value

double

DisplayName

The metric's name as a threshold writes it: p95, ttfc-p95, cost-sum.

public string DisplayName { get; }

Property Value

string

Metric

The metric under budget.

public BowireBenchmarkMetric Metric { get; }

Property Value

BowireBenchmarkMetric

Operator

How the measured value is compared to the budget.

public BowireThresholdOperator Operator { get; }

Property Value

BowireThresholdOperator

ResponseMetric

#621 — the declared response metric under budget (cost in cost-sum < 0.05); null for a built-in Metric.

public string? ResponseMetric { get; }

Property Value

string

Source

The spec as the operator wrote it, for messages and the k6 export.

public string Source { get; }

Property Value

string

Window

#623 — the part of the run the budget applies to: error-rate-last-quarter < 0.02 fails a run that ended badly even when its total passes.

public BowireRunWindow Window { get; }

Property Value

BowireRunWindow

Methods

Evaluate(BowireBenchmarkStats)

Check the threshold against a run's statistics.

public BowireThresholdResult Evaluate(BowireBenchmarkStats stats)

Parameters

stats BowireBenchmarkStats

Returns

BowireThresholdResult

Evaluate(BowireHoldStats)

#624 — check the threshold against a connection hold. A metric a hold has no value for (a latency percentile, a declared response metric, a window) breaches, as an absent metric always does.

public BowireThresholdResult Evaluate(BowireHoldStats stats)

Parameters

stats BowireHoldStats

Returns

BowireThresholdResult

IsFirstChunk(BowireBenchmarkMetric)

#620 — true when the metric is a time to first chunk, which only a streamed run has.

public static bool IsFirstChunk(BowireBenchmarkMetric metric)

Parameters

metric BowireBenchmarkMetric

Returns

bool

IsHold(BowireBenchmarkMetric)

#624 — true for a metric only a connection hold measures.

public static bool IsHold(BowireBenchmarkMetric metric)

Parameters

metric BowireBenchmarkMetric

Returns

bool

IsLatency(BowireBenchmarkMetric)

True when the metric is a latency in milliseconds (for formatting).

public static bool IsLatency(BowireBenchmarkMetric metric)

Parameters

metric BowireBenchmarkMetric

Returns

bool

MetricName(BowireBenchmarkMetric)

Wire / display name of a metric.

public static string MetricName(BowireBenchmarkMetric metric)

Parameters

metric BowireBenchmarkMetric

Returns

string

ToString()

The canonical spelling, used in the TTY summary and as the key in the k6-summary export (k6 keys thresholds by their source text).

public override string ToString()

Returns

string

TryParse(string?, out BowireBenchmarkThreshold?, out string?)

Parse a threshold spec. Returns false with a human-readable error rather than throwing: these come from a command line, so a typo deserves a usage message, not a stack trace.

public static bool TryParse(string? spec, out BowireBenchmarkThreshold? threshold, out string? error)

Parameters

spec string
threshold BowireBenchmarkThreshold
error string

Returns

bool