Existing Traffic Observation

Use CorrelateExistingTraffic with ForDuration when LoadStrike should watch an already-running source and destination flow for a fixed period, with an optional early stop controlled by your application.

What this page helps you do

What this page helps you do

Use CorrelateExistingTraffic with ForDuration when LoadStrike should watch an already-running source and destination flow for a fixed period, with an optional early stop controlled by your application.

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

Existing traffic observation flow showing source and destination consume endpoints, a ForDuration window, and report output.
CorrelateExistingTraffic observes existing source and destination events until the ForDuration window ends or optional cancellation stops it, then reports matches, timeouts, duplicates, unmatched destinations, latency, and groups.

Guide

When To Use It

Choose this mode when another service, scheduled job, user action, or external test is already creating the source traffic. LoadStrike listens to the source and destination endpoints, matches the shared tracking value, and reports the observed outcomes.

Duration Controls The Run

ForDuration is the observation window for CorrelateExistingTraffic. You can pass an optional cancellation token, signal, context, or callback depending on the SDK to stop listening before the full window finishes. Do not add WithLoadSimulations to this scenario, because LoadStrike is not generating traffic in this mode.

Endpoint Shape

Both source and destination endpoints must use Consume mode, and destination is required. Configure both endpoints to read the same TrackingField so LoadStrike can match one workflow across the two sides.

Report Output

Reports show matched messages, unmatched destination messages, timeouts, duplicate tracking values, latency, and any GatherByField groups configured on the destination. A completed or cancelled observation window records the scenario as observed.

Configuration samples

Use these samples to see how Existing Traffic Observation 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.

Existing Traffic Observation

using LoadStrike;

var observationStop = new CancellationTokenSource();

var tracking = 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-observer"
    },
    Destination = new KafkaEndpointDefinition
    {
        Name = "orders-completed",
        Mode = TrafficEndpointMode.Consume,
        TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
        GatherByField = TrackingFieldSelector.Parse("json:$.tenantId"),
        BootstrapServers = "localhost:9092",
        Topic = "orders.completed",
        ConsumerGroupId = "orders-completed-observer"
    },
    RunMode = TrackingRunMode.CorrelateExistingTraffic,
    CorrelationTimeout = TimeSpan.FromSeconds(30)
}.ForDuration(TimeSpan.FromMinutes(10), observationStop.Token);

var scenario = LoadStrikeScenario
    .Empty("observe-orders")
    .WithoutWarmUp()
    .WithCrossPlatformTracking(tracking);

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

Observation setup

RunMode

Set RunMode to CorrelateExistingTraffic when LoadStrike should observe an existing workflow instead of producing source traffic.

ForDuration

Required for CorrelateExistingTraffic. This is the maximum amount of time LoadStrike listens to both endpoints. Pass the optional cancellation token, signal, context, or callback when your application needs to stop the observation before the full window finishes.

Source

Use a Consume endpoint that reads the starting side of the workflow and exposes the shared tracking value.

Destination

Use a Consume endpoint that reads the completion side of the workflow. Destination is required in this mode.

No load simulation

Do not use WithLoadSimulations here. The traffic is already being produced outside LoadStrike.