Asserts And Thresholds

Define pass/fail quality gates for scenario, step, and metrics.

Scenario Threshold

LoadStrikeThreshold.CreateScenario(predicate, abortWhenErrorCount?, startCheckAfter?) validates run-level scenario stats such as RPS, error rate, and latency percentiles.

Step Threshold

LoadStrikeThreshold.CreateStep(stepName, predicate, abortWhenErrorCount?, startCheckAfter?) targets one step by name and validates that step metrics independently.

Metric Threshold

LoadStrikeThreshold.CreateMetric(predicate, abortWhenErrorCount?, startCheckAfter?) evaluates collected metric counters and gauges.

Threshold Fields

All threshold creators support optional abortWhenErrorCount and startCheckAfter for controlled evaluation timing and early-stop behavior.

Feature Usage Samples

How to use snippets for Asserts And Thresholds.

Switch between C#, Java, Python, TypeScript, and JavaScript to see the native SDK shape for this sample.

Licensing note: every runnable sample requires a valid runner key via WithRunnerKey("...") or config key LoadStrike:RunnerKey.

Thresholds

scenario = scenario.WithThresholds(
    LoadStrikeThreshold.CreateScenario(s => s.Fail.Request.Percent < 2),
    LoadStrikeThreshold.CreateStep("GET /health", s => s.Ok.Latency.Percent95 < 300),
    LoadStrikeThreshold.CreateMetric(m => m.Counters.Sum(x => x.Value) >= 0)
);

Threshold Types

CreateScenario

Evaluate scenario-wide metrics such as latency, throughput, or fail percent for the whole workload.

CreateStep

Evaluate one named step independently when a single operation needs its own quality gate.

CreateMetric

Evaluate custom counters and gauges that your scenario registers at runtime.

RegisterMetric(IMetric)

Register the custom metric during scenario initialization so reports, thresholds, and sinks all see the same metric set.