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.
Matching docs
Search across docs titles, summaries, groups, and section headings.
Use Up and Down Arrow to move through results, then press Enter to open the active page.
No indexed docs matched that search. Try a broader term or open the docs hub.
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
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();
package main
import (
"context"
"os"
"os/signal"
loadstrike "loadstrike.com/sdk/go"
)
func main() {
observationContext, stopObservation := signal.NotifyContext(context.Background(), os.Interrupt)
defer stopObservation()
tracking := (&loadstrike.TrackingConfigurationSpec{
Source: &loadstrike.EndpointSpec{
Kind: "Kafka",
Name: "orders-inbound",
Mode: "Consume",
TrackingField: "json:$.trackingId",
Kafka: &loadstrike.KafkaEndpointOptions{
BootstrapServers: "localhost:9092",
Topic: "orders.inbound",
ConsumerGroupID: "orders-inbound-observer",
},
},
Destination: &loadstrike.EndpointSpec{
Kind: "Kafka",
Name: "orders-completed",
Mode: "Consume",
TrackingField: "json:$.trackingId",
GatherByField: "json:$.tenantId",
Kafka: &loadstrike.KafkaEndpointOptions{
BootstrapServers: "localhost:9092",
Topic: "orders.completed",
ConsumerGroupID: "orders-completed-observer",
},
},
RunMode: "CorrelateExistingTraffic",
}).ForDuration(loadstrike.DurationFromSeconds(600), observationContext)
scenario := loadstrike.EmptyScenario("observe-orders").
WithoutWarmUp().
WithCrossPlatformTracking(tracking)
loadstrike.Create().
AddScenario(scenario).
WithRunnerKey("rkl_your_local_runner_key").
Run()
}
import com.loadstrike.runtime.CrossPlatformTrackingConfiguration;
import com.loadstrike.runtime.KafkaEndpointDefinition;
import com.loadstrike.runtime.LoadStrikeCorrelation.TrackingFieldSelector;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeRunner;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeScenario;
import com.loadstrike.runtime.LoadStrikeTransports;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicBoolean;
var observationStop = new AtomicBoolean(false);
var source = new KafkaEndpointDefinition();
source.name = "orders-inbound";
source.mode = LoadStrikeTransports.TrafficEndpointMode.Consume;
source.trackingField = TrackingFieldSelector.parse("json:$.trackingId");
source.bootstrapServers = "localhost:9092";
source.topic = "orders.inbound";
source.consumerGroupId = "orders-inbound-observer";
var destination = new KafkaEndpointDefinition();
destination.name = "orders-completed";
destination.mode = LoadStrikeTransports.TrafficEndpointMode.Consume;
destination.trackingField = TrackingFieldSelector.parse("json:$.trackingId");
destination.gatherByField = TrackingFieldSelector.parse("json:$.tenantId");
destination.bootstrapServers = "localhost:9092";
destination.topic = "orders.completed";
destination.consumerGroupId = "orders-completed-observer";
var tracking = new CrossPlatformTrackingConfiguration();
tracking.source = source;
tracking.destination = destination;
tracking.runMode = LoadStrikeTransports.TrackingRunMode.CorrelateExistingTraffic;
tracking.forDuration(Duration.ofMinutes(10), observationStop::get);
var scenario = LoadStrikeScenario.empty("observe-orders")
.withoutWarmUp()
.withCrossPlatformTracking(tracking);
LoadStrikeRunner.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
import threading
from datetime import timedelta
from loadstrike_sdk import LoadStrikeRunner, LoadStrikeScenario, LoadStrikeTrackingConfigurationSpec
observation_stop = threading.Event()
tracking = LoadStrikeTrackingConfigurationSpec(
Source={
"Kind": "Kafka",
"Name": "orders-inbound",
"Mode": "Consume",
"TrackingField": "json:$.trackingId",
"BootstrapServers": "localhost:9092",
"Topic": "orders.inbound",
"ConsumerGroupId": "orders-inbound-observer",
},
Destination={
"Kind": "Kafka",
"Name": "orders-completed",
"Mode": "Consume",
"TrackingField": "json:$.trackingId",
"GatherByField": "json:$.tenantId",
"BootstrapServers": "localhost:9092",
"Topic": "orders.completed",
"ConsumerGroupId": "orders-completed-observer",
},
RunMode="CorrelateExistingTraffic",
).for_duration(timedelta(minutes=10), observation_stop)
scenario = (
LoadStrikeScenario.empty("observe-orders")
.without_warm_up()
.with_cross_platform_tracking(tracking)
)
LoadStrikeRunner.register_scenarios(scenario) \
.with_runner_key("rkl_your_local_runner_key") \
.run()
import {
CrossPlatformTrackingConfiguration,
LoadStrikeRunner,
LoadStrikeScenario
} from "@loadstrike/loadstrike-sdk";
const observationController = new AbortController();
const tracking = CrossPlatformTrackingConfiguration.forDuration({
Source: {
Kind: "Kafka",
Name: "orders-inbound",
Mode: "Consume",
TrackingField: "json:$.trackingId",
BootstrapServers: "localhost:9092",
Topic: "orders.inbound",
ConsumerGroupId: "orders-inbound-observer"
},
Destination: {
Kind: "Kafka",
Name: "orders-completed",
Mode: "Consume",
TrackingField: "json:$.trackingId",
GatherByField: "json:$.tenantId",
BootstrapServers: "localhost:9092",
Topic: "orders.completed",
ConsumerGroupId: "orders-completed-observer"
},
RunMode: "CorrelateExistingTraffic"
}, 600, observationController.signal);
const scenario = LoadStrikeScenario
.empty("observe-orders")
.withoutWarmUp()
.withCrossPlatformTracking(tracking);
await LoadStrikeRunner
.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
const {
CrossPlatformTrackingConfiguration,
LoadStrikeRunner,
LoadStrikeScenario
} = require("@loadstrike/loadstrike-sdk");
(async () => {
const observationController = new AbortController();
const tracking = CrossPlatformTrackingConfiguration.forDuration({
Source: {
Kind: "Kafka",
Name: "orders-inbound",
Mode: "Consume",
TrackingField: "json:$.trackingId",
BootstrapServers: "localhost:9092",
Topic: "orders.inbound",
ConsumerGroupId: "orders-inbound-observer"
},
Destination: {
Kind: "Kafka",
Name: "orders-completed",
Mode: "Consume",
TrackingField: "json:$.trackingId",
GatherByField: "json:$.tenantId",
BootstrapServers: "localhost:9092",
Topic: "orders.completed",
ConsumerGroupId: "orders-completed-observer"
},
RunMode: "CorrelateExistingTraffic"
}, 600, observationController.signal);
const scenario = LoadStrikeScenario
.empty("observe-orders")
.withoutWarmUp()
.withCrossPlatformTracking(tracking);
await LoadStrikeRunner
.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
})();
Observation setup
Set RunMode to CorrelateExistingTraffic when LoadStrike should observe an existing workflow instead of producing source traffic.
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.
Use a Consume endpoint that reads the starting side of the workflow and exposes the shared tracking value.
Use a Consume endpoint that reads the completion side of the workflow. Destination is required in this mode.
Do not use WithLoadSimulations here. The traffic is already being produced outside LoadStrike.