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)
);
scenario = scenario.withThresholds(
LoadStrikeThreshold.scenario("allFailCount", "lt", 2d),
LoadStrikeThreshold.step("GET /health", "allOkCount", "gte", 1d),
LoadStrikeThreshold.metric("durationMs", "gte", 0d)
);
scenario = scenario.with_thresholds(
LoadStrikeThreshold.scenario("allfailcount", "lt", 2),
LoadStrikeThreshold.step("GET /health", "allokcount", "gte", 1),
LoadStrikeThreshold.metric("durationms", "gte", 0),
)
scenario = scenario.withThresholds(
LoadStrikeThreshold.scenario("allFailCount", "lt", 2),
LoadStrikeThreshold.step("GET /health", "allOkCount", "gte", 1),
LoadStrikeThreshold.metric("durationMs", "gte", 0)
);
scenario = scenario.withThresholds(
LoadStrikeThreshold.scenario("allFailCount", "lt", 2),
LoadStrikeThreshold.step("GET /health", "allOkCount", "gte", 1),
LoadStrikeThreshold.metric("durationMs", "gte", 0)
);
Threshold Types
Evaluate scenario-wide metrics such as latency, throughput, or fail percent for the whole workload.
Evaluate one named step independently when a single operation needs its own quality gate.
Evaluate custom counters and gauges that your scenario registers at runtime.
Register the custom metric during scenario initialization so reports, thresholds, and sinks all see the same metric set.