Run Modes

Run modes decide whether LoadStrike should generate the source traffic itself or only observe traffic that already exists.

What this page helps you do

What this page helps you do

Run modes decide whether LoadStrike should generate the source traffic itself or only observe traffic that already exists.

Who this is for

Teams controlling runtime behavior, tracking, reporting, licensing, or policy from code, JSON, or CLI settings.

Prerequisites

  • A scenario or run configuration that already works locally

By the end

The documented runtime setting or policy surface for this part of the product.

Use this page when

Use this page when runtime behavior changes because of configuration, policy, or execution settings rather than the scenario body itself.

Visual guide

Run mode decision diagram for generated, observed, and source-only flows.
Run mode is chosen by whether LoadStrike creates source traffic, observes existing traffic, or reports only the source side.

Guide

GenerateAndCorrelate

Use GenerateAndCorrelate when LoadStrike should send the source traffic and then wait for the downstream outcome. This is the normal choice when the test itself is responsible for starting the workflow.

CorrelateExistingTraffic

Use CorrelateExistingTraffic when both the source and destination already exist in the live flow and LoadStrike only needs to observe and correlate them for a ForDuration window. The SDKs also let your application stop that observation early with the optional cancellation parameter.

How To Choose

Choose the mode based on who starts the workflow. If the test should create the source event, use GenerateAndCorrelate. If another system already creates the traffic and you only need visibility, use CorrelateExistingTraffic.

Configuration samples

Use these samples to see how Run Modes is configured in code, JSON, or CLI surfaces where this page documents them.

If you run these examples locally, add a valid runner key before execution starts. Set it with WithRunnerKey("...") or the config key LoadStrike:RunnerKey.

Run Modes

using LoadStrike;

var generateAndCorrelate = new CrossPlatformTrackingConfiguration
{
    Source = new HttpEndpointDefinition
    {
        Name = "orders-api",
        Mode = TrafficEndpointMode.Produce,
        TrackingField = TrackingFieldSelector.Parse("header:X-Correlation-Id"),
        Url = "https://api.example.com/orders",
        Method = "POST"
    },
    Destination = new KafkaEndpointDefinition
    {
        Name = "orders-events",
        Mode = TrafficEndpointMode.Consume,
        TrackingField = TrackingFieldSelector.Parse("header:X-Correlation-Id"),
        BootstrapServers = "localhost:9092",
        Topic = "orders.completed",
        ConsumerGroupId = "orders-tests"
    },
    RunMode = TrackingRunMode.GenerateAndCorrelate
};

var correlateExistingTraffic = new CrossPlatformTrackingConfiguration
{
    Source = new KafkaEndpointDefinition
    {
        Name = "orders-inbound",
        Mode = TrafficEndpointMode.Consume,
        TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
        BootstrapServers = "localhost:9092",
        Topic = "orders.inbound",
        ConsumerGroupId = "orders-inbound-tests"
    },
    Destination = new KafkaEndpointDefinition
    {
        Name = "orders-events",
        Mode = TrafficEndpointMode.Consume,
        TrackingField = TrackingFieldSelector.Parse("header:X-Correlation-Id"),
        BootstrapServers = "localhost:9092",
        Topic = "orders.completed",
        ConsumerGroupId = "orders-tests"
    },
    RunMode = TrackingRunMode.CorrelateExistingTraffic
}.ForDuration(TimeSpan.FromMinutes(10));

var scenario = CrossPlatformScenarioConfigurator
    .Configure(LoadStrikeScenario.Empty("orders-run-mode-demo"), generateAndCorrelate)
    .WithLoadSimulations(LoadStrikeSimulation.Inject(10, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(20)));

LoadStrikeRunner.RegisterScenarios(scenario)
    .WithRunnerKey("rkl_your_local_runner_key")
    .Run();

Tracking run mode values

GenerateAndCorrelate

LoadStrike produces the source event itself, then waits for the destination match. Source must use Produce mode. Destination may be omitted for source-only measurement, but when present it must use Consume mode.

CorrelateExistingTraffic

LoadStrike only observes traffic that another system is already producing. Both source and destination must use Consume mode, destination is required, and ForDuration defines the observation window. SDKs can also stop that observation early with the optional cancellation parameter.