@loadstrike/loadstrike-sdk 1.0.22601 → 1.0.22801
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/local.js +13 -0
- package/dist/cjs/runtime.js +126 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/local.js +13 -0
- package/dist/esm/runtime.js +125 -2
- package/dist/types/contracts.d.ts +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/runtime.d.ts +9 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.TimescaleDbReportingSinkOptions = exports.TimescaleDbReportingSink = exports.SplunkReportingSinkOptions = exports.SplunkReportingSink = exports.OtelCollectorReportingSinkOptions = exports.OtelCollectorReportingSink = void 0;
|
|
3
|
+
exports.InfluxDbReportingSink = exports.GrafanaLokiReportingSinkOptions = exports.GrafanaLokiReportingSink = exports.DatadogReportingSinkOptions = exports.DatadogReportingSink = exports.HttpAuthOptions = exports.HttpOAuth2ClientCredentialsOptions = exports.PushDiffusionEndpointDefinition = exports.DelegateStreamEndpointDefinition = exports.AzureEventHubsEndpointDefinition = exports.RedisStreamsEndpointDefinition = exports.NatsEndpointDefinition = exports.RabbitMqEndpointDefinition = exports.KafkaSaslOptions = exports.KafkaEndpointDefinition = exports.HttpEndpointDefinition = exports.TrafficEndpointDefinition = exports.LOADSTRIKE_TRACE_ID_TRACKING_FIELD = exports.LOADSTRIKE_TRACE_ID_HEADER = exports.EndpointAdapterFactory = exports.TrackingFieldSelector = exports.TrackingPayloadBuilder = exports.RedisCorrelationStore = exports.RedisCorrelationStoreOptions = exports.InMemoryCorrelationStore = exports.CrossPlatformTrackingRuntime = exports.CorrelationStoreConfiguration = exports.LoadStrikeThreshold = exports.LoadStrikeStep = exports.LoadStrikeGauge = exports.LoadStrikeCounter = exports.LoadStrikeMetric = exports.CrossPlatformTrackingConfiguration = exports.LoadStrikeSimulation = exports.LoadStrikeScenario = exports.LoadStrikeRunner = exports.LoadStrikeOperationType = exports.LoadStrikeScenarioOperation = exports.LoadStrikeLogLevel = exports.LoadStrikeResponse = exports.LoadStrikeReportFormat = exports.LoadStrikeNodeType = exports.LoadStrikePluginDataTable = exports.LoadStrikePluginData = exports.LoadStrikeContext = exports.ScenarioTrackingExtensions = exports.CrossPlatformScenarioConfigurator = exports.LoadStrikeAutopilotReadiness = exports.LoadStrikeAutopilotResult = exports.LoadStrikeAutopilot = void 0;
|
|
4
|
+
exports.TimescaleDbReportingSinkOptions = exports.TimescaleDbReportingSink = exports.SplunkReportingSinkOptions = exports.SplunkReportingSink = exports.OtelCollectorReportingSinkOptions = exports.OtelCollectorReportingSink = exports.InfluxDbReportingSinkOptions = void 0;
|
|
5
5
|
var autopilot_js_1 = require("./autopilot.js");
|
|
6
6
|
Object.defineProperty(exports, "LoadStrikeAutopilot", { enumerable: true, get: function () { return autopilot_js_1.LoadStrikeAutopilot; } });
|
|
7
7
|
Object.defineProperty(exports, "LoadStrikeAutopilotResult", { enumerable: true, get: function () { return autopilot_js_1.LoadStrikeAutopilotResult; } });
|
|
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "LoadStrikeOperationType", { enumerable: true, ge
|
|
|
22
22
|
Object.defineProperty(exports, "LoadStrikeRunner", { enumerable: true, get: function () { return runtime_js_1.LoadStrikeRunner; } });
|
|
23
23
|
Object.defineProperty(exports, "LoadStrikeScenario", { enumerable: true, get: function () { return runtime_js_1.LoadStrikeScenario; } });
|
|
24
24
|
Object.defineProperty(exports, "LoadStrikeSimulation", { enumerable: true, get: function () { return runtime_js_1.LoadStrikeSimulation; } });
|
|
25
|
+
Object.defineProperty(exports, "CrossPlatformTrackingConfiguration", { enumerable: true, get: function () { return runtime_js_1.CrossPlatformTrackingConfiguration; } });
|
|
25
26
|
Object.defineProperty(exports, "LoadStrikeMetric", { enumerable: true, get: function () { return runtime_js_1.LoadStrikeMetric; } });
|
|
26
27
|
Object.defineProperty(exports, "LoadStrikeCounter", { enumerable: true, get: function () { return runtime_js_1.LoadStrikeCounter; } });
|
|
27
28
|
Object.defineProperty(exports, "LoadStrikeGauge", { enumerable: true, get: function () { return runtime_js_1.LoadStrikeGauge; } });
|
package/dist/cjs/local.js
CHANGED
|
@@ -1047,10 +1047,20 @@ function validateTrackingConfiguration(tracking, sourceEndpoint, destinationEndp
|
|
|
1047
1047
|
if (!metricPrefix.trim()) {
|
|
1048
1048
|
throw new Error("MetricPrefix must be provided.");
|
|
1049
1049
|
}
|
|
1050
|
+
const observationDurationOverride = pickValue(tracking, "ObservationDurationMs", "observationDurationMs");
|
|
1051
|
+
const observationDurationSeconds = pickValue(tracking, "ObservationDurationSeconds", "observationDurationSeconds", "ObservationDuration");
|
|
1052
|
+
const observationDurationMs = observationDurationOverride != null && String(observationDurationOverride).trim() !== ""
|
|
1053
|
+
? asNumber(observationDurationOverride)
|
|
1054
|
+
: (observationDurationSeconds == null || String(observationDurationSeconds).trim() === ""
|
|
1055
|
+
? 0
|
|
1056
|
+
: asNumber(observationDurationSeconds) * 1000);
|
|
1050
1057
|
validateRedisCorrelationStoreConfiguration(tracking);
|
|
1051
1058
|
const runModeRaw = stringOrDefault(pickValue(tracking, "RunMode", "runMode"), "GenerateAndCorrelate").trim().toLowerCase();
|
|
1052
1059
|
const runMode = runModeRaw === "sourceonly" ? "generateandcorrelate" : runModeRaw;
|
|
1053
1060
|
if (runMode === "generateandcorrelate") {
|
|
1061
|
+
if (observationDurationMs > 0) {
|
|
1062
|
+
throw new Error("ForDuration is only supported for CorrelateExistingTraffic.");
|
|
1063
|
+
}
|
|
1054
1064
|
if (sourceEndpoint.mode !== "Produce") {
|
|
1055
1065
|
throw new Error("Source endpoint mode must be Produce for GenerateAndCorrelate mode.");
|
|
1056
1066
|
}
|
|
@@ -1060,6 +1070,9 @@ function validateTrackingConfiguration(tracking, sourceEndpoint, destinationEndp
|
|
|
1060
1070
|
return;
|
|
1061
1071
|
}
|
|
1062
1072
|
if (runMode === "correlateexistingtraffic") {
|
|
1073
|
+
if (observationDurationMs <= 0) {
|
|
1074
|
+
throw new Error("CorrelateExistingTraffic requires ForDuration with a duration greater than zero.");
|
|
1075
|
+
}
|
|
1063
1076
|
if (!destinationEndpoint) {
|
|
1064
1077
|
throw new Error("Destination endpoint must be provided for CorrelateExistingTraffic mode.");
|
|
1065
1078
|
}
|
package/dist/cjs/runtime.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.__loadstrikeTestExports = exports.LoadStrikeRunner = exports.LoadStrikeScenario = exports.LoadStrikeContext = exports.ScenarioTrackingExtensions = exports.CrossPlatformScenarioConfigurator = exports.LoadStrikeThreshold = exports.LoadStrikeMetric = exports.LoadStrikeGauge = exports.LoadStrikeCounter = exports.LoadStrikeSimulation = exports.LoadStrikeStep = exports.LoadStrikeResponse = exports.LoadStrikePluginData = exports.LoadStrikePluginDataTable = exports.LoadStrikeOperationType = exports.LoadStrikeScenarioOperation = exports.LoadStrikeLogLevel = exports.LoadStrikeReportFormat = exports.LoadStrikeNodeType = void 0;
|
|
6
|
+
exports.__loadstrikeTestExports = exports.LoadStrikeRunner = exports.LoadStrikeScenario = exports.LoadStrikeContext = exports.ScenarioTrackingExtensions = exports.CrossPlatformScenarioConfigurator = exports.LoadStrikeThreshold = exports.LoadStrikeMetric = exports.LoadStrikeGauge = exports.LoadStrikeCounter = exports.LoadStrikeSimulation = exports.LoadStrikeStep = exports.LoadStrikeResponse = exports.LoadStrikePluginData = exports.LoadStrikePluginDataTable = exports.CrossPlatformTrackingConfiguration = exports.LoadStrikeOperationType = exports.LoadStrikeScenarioOperation = exports.LoadStrikeLogLevel = exports.LoadStrikeReportFormat = exports.LoadStrikeNodeType = void 0;
|
|
7
7
|
const node_fs_1 = require("node:fs");
|
|
8
8
|
const node_crypto_1 = require("node:crypto");
|
|
9
9
|
const node_os_1 = __importDefault(require("node:os"));
|
|
@@ -47,6 +47,33 @@ exports.LoadStrikeOperationType = {
|
|
|
47
47
|
Complete: "Complete",
|
|
48
48
|
Error: "Error"
|
|
49
49
|
};
|
|
50
|
+
exports.CrossPlatformTrackingConfiguration = {
|
|
51
|
+
forDuration(configuration, durationSeconds, cancellationSignal) {
|
|
52
|
+
if (!configuration || typeof configuration !== "object" || Array.isArray(configuration)) {
|
|
53
|
+
throw new TypeError("Tracking configuration must be provided.");
|
|
54
|
+
}
|
|
55
|
+
if (normalizeTrackingRunMode(pickTrackingString(configuration, "RunMode", "runMode", "GenerateAndCorrelate")) !== "correlateexistingtraffic") {
|
|
56
|
+
throw new Error("ForDuration can only be used with CorrelateExistingTraffic.");
|
|
57
|
+
}
|
|
58
|
+
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
59
|
+
throw new RangeError("ForDuration duration must be greater than zero.");
|
|
60
|
+
}
|
|
61
|
+
const result = {
|
|
62
|
+
...configuration,
|
|
63
|
+
ObservationDurationSeconds: durationSeconds
|
|
64
|
+
};
|
|
65
|
+
if (cancellationSignal !== undefined) {
|
|
66
|
+
if (!(cancellationSignal instanceof AbortSignal)) {
|
|
67
|
+
throw new TypeError("ForDuration cancellation signal must be an AbortSignal.");
|
|
68
|
+
}
|
|
69
|
+
result.ObservationCancellationSignal = cancellationSignal;
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
},
|
|
73
|
+
ForDuration(configuration, durationSeconds, cancellationSignal) {
|
|
74
|
+
return this.forDuration(configuration, durationSeconds, cancellationSignal);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
50
77
|
class LoadStrikePluginDataTable {
|
|
51
78
|
/**
|
|
52
79
|
* Exposes the public constructor operation.
|
|
@@ -1730,6 +1757,9 @@ class LoadStrikeScenario {
|
|
|
1730
1757
|
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
1731
1758
|
: null;
|
|
1732
1759
|
validateRuntimeTrackingConfiguration(copied, sourceEndpoint, destinationEndpoint);
|
|
1760
|
+
if (isCorrelateExistingTrafficTracking(copied) && this.loadSimulations.length > 0) {
|
|
1761
|
+
throw new Error("CorrelateExistingTraffic uses ForDuration and cannot be combined with WithLoadSimulations.");
|
|
1762
|
+
}
|
|
1733
1763
|
return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, copied, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail, this.internalLicenseFeatures);
|
|
1734
1764
|
}
|
|
1735
1765
|
/**
|
|
@@ -1740,6 +1770,9 @@ class LoadStrikeScenario {
|
|
|
1740
1770
|
if (!simulations.length) {
|
|
1741
1771
|
throw new Error("At least one load simulation should be provided.");
|
|
1742
1772
|
}
|
|
1773
|
+
if (isCorrelateExistingTrafficTracking(this.trackingConfiguration)) {
|
|
1774
|
+
throw new Error("CorrelateExistingTraffic uses ForDuration and cannot be combined with WithLoadSimulations.");
|
|
1775
|
+
}
|
|
1743
1776
|
return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, simulations.map((simulation) => attachLoadSimulationProjection({ ...simulation })), this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail, this.internalLicenseFeatures);
|
|
1744
1777
|
}
|
|
1745
1778
|
/**
|
|
@@ -5741,6 +5774,14 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5741
5774
|
this.sourceOnlyMode = this.destinationEndpoint == null;
|
|
5742
5775
|
this.executeOriginalScenarioRun = pickTrackingBoolean(tracking, "ExecuteOriginalScenarioRun", "executeOriginalScenarioRun", false);
|
|
5743
5776
|
this.correlationTimeoutMs = Math.trunc(pickTrackingNumber(tracking, ["CorrelationTimeoutMs", "correlationTimeoutMs"], pickTrackingNumber(tracking, ["CorrelationTimeoutSeconds", "correlationTimeoutSeconds", "CorrelationTimeout"], 30) * 1000));
|
|
5777
|
+
this.observationDurationMs = Math.trunc(readObservationDurationMs(tracking));
|
|
5778
|
+
const observationCancellationSignal = pickTrackingValue(tracking, "ObservationCancellationSignal", "observationCancellationSignal");
|
|
5779
|
+
if (observationCancellationSignal !== undefined) {
|
|
5780
|
+
if (!(observationCancellationSignal instanceof AbortSignal)) {
|
|
5781
|
+
throw new TypeError("ObservationCancellationSignal must be an AbortSignal.");
|
|
5782
|
+
}
|
|
5783
|
+
this.observationCancellationSignal = observationCancellationSignal;
|
|
5784
|
+
}
|
|
5744
5785
|
this.timeoutSweepIntervalMs = Math.trunc(pickTrackingNumber(tracking, ["TimeoutSweepIntervalMs", "timeoutSweepIntervalMs"], pickTrackingNumber(tracking, ["TimeoutSweepIntervalSeconds", "timeoutSweepIntervalSeconds"], 1) * 1000));
|
|
5745
5786
|
this.timeoutBatchSize = Math.trunc(pickTrackingNumber(tracking, ["TimeoutBatchSize", "timeoutBatchSize"], 200));
|
|
5746
5787
|
this.timeoutCountsAsFailure = pickTrackingBoolean(tracking, "TimeoutCountsAsFailure", "timeoutCountsAsFailure", true);
|
|
@@ -5881,8 +5922,7 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5881
5922
|
return this.executeSourceOnly();
|
|
5882
5923
|
}
|
|
5883
5924
|
if (this.runMode === "correlateexistingtraffic") {
|
|
5884
|
-
|
|
5885
|
-
return this.toResponse(outcome);
|
|
5925
|
+
return await this.observeExistingTraffic(context.scenarioCancellationToken);
|
|
5886
5926
|
}
|
|
5887
5927
|
let producedPayload;
|
|
5888
5928
|
try {
|
|
@@ -5958,6 +5998,45 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5958
5998
|
});
|
|
5959
5999
|
return LoadStrikeResponse.ok("source_success");
|
|
5960
6000
|
}
|
|
6001
|
+
async observeExistingTraffic(signal) {
|
|
6002
|
+
const deadline = Date.now() + this.observationDurationMs;
|
|
6003
|
+
const observationSignal = this.observationCancellationSignal
|
|
6004
|
+
? combineAbortSignals(signal, this.observationCancellationSignal)
|
|
6005
|
+
: signal;
|
|
6006
|
+
let failureSeen = false;
|
|
6007
|
+
while (Date.now() < deadline && !observationSignal.aborted) {
|
|
6008
|
+
let outcome;
|
|
6009
|
+
try {
|
|
6010
|
+
outcome = await this.waitForOutcomeUntil(deadline, observationSignal);
|
|
6011
|
+
}
|
|
6012
|
+
catch (error) {
|
|
6013
|
+
if (this.observationCancellationSignal?.aborted && !signal.aborted) {
|
|
6014
|
+
break;
|
|
6015
|
+
}
|
|
6016
|
+
throw error;
|
|
6017
|
+
}
|
|
6018
|
+
if (!outcome) {
|
|
6019
|
+
break;
|
|
6020
|
+
}
|
|
6021
|
+
failureSeen = failureSeen || this.isFailedObservationOutcome(outcome);
|
|
6022
|
+
}
|
|
6023
|
+
this.shutdown = true;
|
|
6024
|
+
await Promise.all([
|
|
6025
|
+
this.sourceLoop,
|
|
6026
|
+
this.destinationLoop,
|
|
6027
|
+
this.timeoutLoop
|
|
6028
|
+
].filter(Boolean).map((value) => value.catch(() => { })));
|
|
6029
|
+
await this.correlationRuntime.sweepTimeouts(Date.now() + this.correlationTimeoutMs + 1, this.timeoutBatchSize);
|
|
6030
|
+
while (this.outcomeQueue.length > 0) {
|
|
6031
|
+
const outcome = this.outcomeQueue.shift();
|
|
6032
|
+
if (outcome) {
|
|
6033
|
+
failureSeen = failureSeen || this.isFailedObservationOutcome(outcome);
|
|
6034
|
+
}
|
|
6035
|
+
}
|
|
6036
|
+
return failureSeen
|
|
6037
|
+
? LoadStrikeResponse.fail("tracking_failures", "One or more observed source or destination events did not correlate successfully.", 0)
|
|
6038
|
+
: LoadStrikeResponse.ok("observed");
|
|
6039
|
+
}
|
|
5961
6040
|
async consumeSourceLoop() {
|
|
5962
6041
|
while (!this.shutdown) {
|
|
5963
6042
|
try {
|
|
@@ -6171,6 +6250,34 @@ class ManagedScenarioTrackingRuntime {
|
|
|
6171
6250
|
}
|
|
6172
6251
|
}
|
|
6173
6252
|
}
|
|
6253
|
+
async waitForOutcomeUntil(deadlineMs, signal) {
|
|
6254
|
+
const existing = this.outcomeQueue.shift();
|
|
6255
|
+
if (existing) {
|
|
6256
|
+
return existing;
|
|
6257
|
+
}
|
|
6258
|
+
const remainingMs = deadlineMs - Date.now();
|
|
6259
|
+
if (remainingMs <= 0) {
|
|
6260
|
+
return null;
|
|
6261
|
+
}
|
|
6262
|
+
const waiter = createManagedTrackingWaiter();
|
|
6263
|
+
this.outcomeWaiters.push(waiter);
|
|
6264
|
+
const timeout = sleep(remainingMs).then(() => null);
|
|
6265
|
+
try {
|
|
6266
|
+
return await Promise.race([waiter.promise, timeout, waitForAbort(signal)]);
|
|
6267
|
+
}
|
|
6268
|
+
finally {
|
|
6269
|
+
const index = this.outcomeWaiters.indexOf(waiter);
|
|
6270
|
+
if (index >= 0) {
|
|
6271
|
+
this.outcomeWaiters.splice(index, 1);
|
|
6272
|
+
}
|
|
6273
|
+
}
|
|
6274
|
+
}
|
|
6275
|
+
isFailedObservationOutcome(outcome) {
|
|
6276
|
+
if (outcome.status === "timeout") {
|
|
6277
|
+
return this.timeoutCountsAsFailure;
|
|
6278
|
+
}
|
|
6279
|
+
return outcome.status !== "matched";
|
|
6280
|
+
}
|
|
6174
6281
|
rejectOutstandingWaiters() {
|
|
6175
6282
|
for (const rows of this.waiters.values()) {
|
|
6176
6283
|
for (const waiter of rows) {
|
|
@@ -6290,8 +6397,12 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6290
6397
|
if (!metricPrefix.trim()) {
|
|
6291
6398
|
throw new Error("MetricPrefix must be provided.");
|
|
6292
6399
|
}
|
|
6400
|
+
const observationDurationMs = readObservationDurationMs(tracking);
|
|
6293
6401
|
validateRuntimeRedisCorrelationStoreConfiguration(tracking);
|
|
6294
6402
|
if (runMode === "generateandcorrelate") {
|
|
6403
|
+
if (observationDurationMs > 0) {
|
|
6404
|
+
throw new Error("ForDuration is only supported for CorrelateExistingTraffic.");
|
|
6405
|
+
}
|
|
6295
6406
|
if (sourceEndpoint.mode !== "Produce") {
|
|
6296
6407
|
throw new Error("Source endpoint mode must be Produce for GenerateAndCorrelate mode.");
|
|
6297
6408
|
}
|
|
@@ -6301,6 +6412,9 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6301
6412
|
return;
|
|
6302
6413
|
}
|
|
6303
6414
|
if (runMode === "correlateexistingtraffic") {
|
|
6415
|
+
if (observationDurationMs <= 0) {
|
|
6416
|
+
throw new Error("CorrelateExistingTraffic requires ForDuration with a duration greater than zero.");
|
|
6417
|
+
}
|
|
6304
6418
|
if (!destinationEndpoint) {
|
|
6305
6419
|
throw new Error("Destination endpoint must be provided for CorrelateExistingTraffic mode.");
|
|
6306
6420
|
}
|
|
@@ -6314,6 +6428,15 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6314
6428
|
}
|
|
6315
6429
|
throw new RangeError(`Unsupported tracking run mode: ${runMode}.`);
|
|
6316
6430
|
}
|
|
6431
|
+
function readObservationDurationMs(tracking) {
|
|
6432
|
+
return pickTrackingNumber(tracking, ["ObservationDurationMs", "observationDurationMs"], pickTrackingNumber(tracking, ["ObservationDurationSeconds", "observationDurationSeconds", "ObservationDuration"], 0) * 1000);
|
|
6433
|
+
}
|
|
6434
|
+
function isCorrelateExistingTrafficTracking(configuration) {
|
|
6435
|
+
if (!configuration) {
|
|
6436
|
+
return false;
|
|
6437
|
+
}
|
|
6438
|
+
return normalizeTrackingRunMode(pickTrackingString(configuration, "RunMode", "runMode", "GenerateAndCorrelate")) === "correlateexistingtraffic";
|
|
6439
|
+
}
|
|
6317
6440
|
function readUseLoadStrikeTraceIdHeader(tracking) {
|
|
6318
6441
|
return pickTrackingBoolean(tracking, "UseLoadStrikeTraceIdHeader", "useLoadStrikeTraceIdHeader", false);
|
|
6319
6442
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { LoadStrikeAutopilot, LoadStrikeAutopilotResult } from "./autopilot.js";
|
|
2
2
|
export { LoadStrikeAutopilotReadiness } from "./autopilot-contracts.js";
|
|
3
|
-
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
3
|
+
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation, CrossPlatformTrackingConfiguration, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
4
4
|
export { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, InMemoryCorrelationStore, RedisCorrelationStoreOptions, RedisCorrelationStore, TrackingPayloadBuilder, TrackingFieldSelector } from "./correlation.js";
|
|
5
5
|
export { EndpointAdapterFactory, LOADSTRIKE_TRACE_ID_HEADER, LOADSTRIKE_TRACE_ID_TRACKING_FIELD, TrafficEndpointDefinition, HttpEndpointDefinition, KafkaEndpointDefinition, KafkaSaslOptions, RabbitMqEndpointDefinition, NatsEndpointDefinition, RedisStreamsEndpointDefinition, AzureEventHubsEndpointDefinition, DelegateStreamEndpointDefinition, PushDiffusionEndpointDefinition, HttpOAuth2ClientCredentialsOptions, HttpAuthOptions } from "./transports.js";
|
|
6
6
|
export { DatadogReportingSink, DatadogReportingSinkOptions, GrafanaLokiReportingSink, GrafanaLokiReportingSinkOptions, InfluxDbReportingSink, InfluxDbReportingSinkOptions, OtelCollectorReportingSink, OtelCollectorReportingSinkOptions, SplunkReportingSink, SplunkReportingSinkOptions, TimescaleDbReportingSink, TimescaleDbReportingSinkOptions } from "./sinks.js";
|
package/dist/esm/local.js
CHANGED
|
@@ -1007,10 +1007,20 @@ function validateTrackingConfiguration(tracking, sourceEndpoint, destinationEndp
|
|
|
1007
1007
|
if (!metricPrefix.trim()) {
|
|
1008
1008
|
throw new Error("MetricPrefix must be provided.");
|
|
1009
1009
|
}
|
|
1010
|
+
const observationDurationOverride = pickValue(tracking, "ObservationDurationMs", "observationDurationMs");
|
|
1011
|
+
const observationDurationSeconds = pickValue(tracking, "ObservationDurationSeconds", "observationDurationSeconds", "ObservationDuration");
|
|
1012
|
+
const observationDurationMs = observationDurationOverride != null && String(observationDurationOverride).trim() !== ""
|
|
1013
|
+
? asNumber(observationDurationOverride)
|
|
1014
|
+
: (observationDurationSeconds == null || String(observationDurationSeconds).trim() === ""
|
|
1015
|
+
? 0
|
|
1016
|
+
: asNumber(observationDurationSeconds) * 1000);
|
|
1010
1017
|
validateRedisCorrelationStoreConfiguration(tracking);
|
|
1011
1018
|
const runModeRaw = stringOrDefault(pickValue(tracking, "RunMode", "runMode"), "GenerateAndCorrelate").trim().toLowerCase();
|
|
1012
1019
|
const runMode = runModeRaw === "sourceonly" ? "generateandcorrelate" : runModeRaw;
|
|
1013
1020
|
if (runMode === "generateandcorrelate") {
|
|
1021
|
+
if (observationDurationMs > 0) {
|
|
1022
|
+
throw new Error("ForDuration is only supported for CorrelateExistingTraffic.");
|
|
1023
|
+
}
|
|
1014
1024
|
if (sourceEndpoint.mode !== "Produce") {
|
|
1015
1025
|
throw new Error("Source endpoint mode must be Produce for GenerateAndCorrelate mode.");
|
|
1016
1026
|
}
|
|
@@ -1020,6 +1030,9 @@ function validateTrackingConfiguration(tracking, sourceEndpoint, destinationEndp
|
|
|
1020
1030
|
return;
|
|
1021
1031
|
}
|
|
1022
1032
|
if (runMode === "correlateexistingtraffic") {
|
|
1033
|
+
if (observationDurationMs <= 0) {
|
|
1034
|
+
throw new Error("CorrelateExistingTraffic requires ForDuration with a duration greater than zero.");
|
|
1035
|
+
}
|
|
1023
1036
|
if (!destinationEndpoint) {
|
|
1024
1037
|
throw new Error("Destination endpoint must be provided for CorrelateExistingTraffic mode.");
|
|
1025
1038
|
}
|
package/dist/esm/runtime.js
CHANGED
|
@@ -41,6 +41,33 @@ export const LoadStrikeOperationType = {
|
|
|
41
41
|
Complete: "Complete",
|
|
42
42
|
Error: "Error"
|
|
43
43
|
};
|
|
44
|
+
export const CrossPlatformTrackingConfiguration = {
|
|
45
|
+
forDuration(configuration, durationSeconds, cancellationSignal) {
|
|
46
|
+
if (!configuration || typeof configuration !== "object" || Array.isArray(configuration)) {
|
|
47
|
+
throw new TypeError("Tracking configuration must be provided.");
|
|
48
|
+
}
|
|
49
|
+
if (normalizeTrackingRunMode(pickTrackingString(configuration, "RunMode", "runMode", "GenerateAndCorrelate")) !== "correlateexistingtraffic") {
|
|
50
|
+
throw new Error("ForDuration can only be used with CorrelateExistingTraffic.");
|
|
51
|
+
}
|
|
52
|
+
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
53
|
+
throw new RangeError("ForDuration duration must be greater than zero.");
|
|
54
|
+
}
|
|
55
|
+
const result = {
|
|
56
|
+
...configuration,
|
|
57
|
+
ObservationDurationSeconds: durationSeconds
|
|
58
|
+
};
|
|
59
|
+
if (cancellationSignal !== undefined) {
|
|
60
|
+
if (!(cancellationSignal instanceof AbortSignal)) {
|
|
61
|
+
throw new TypeError("ForDuration cancellation signal must be an AbortSignal.");
|
|
62
|
+
}
|
|
63
|
+
result.ObservationCancellationSignal = cancellationSignal;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
},
|
|
67
|
+
ForDuration(configuration, durationSeconds, cancellationSignal) {
|
|
68
|
+
return this.forDuration(configuration, durationSeconds, cancellationSignal);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
44
71
|
export class LoadStrikePluginDataTable {
|
|
45
72
|
/**
|
|
46
73
|
* Exposes the public constructor operation.
|
|
@@ -1712,6 +1739,9 @@ export class LoadStrikeScenario {
|
|
|
1712
1739
|
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
1713
1740
|
: null;
|
|
1714
1741
|
validateRuntimeTrackingConfiguration(copied, sourceEndpoint, destinationEndpoint);
|
|
1742
|
+
if (isCorrelateExistingTrafficTracking(copied) && this.loadSimulations.length > 0) {
|
|
1743
|
+
throw new Error("CorrelateExistingTraffic uses ForDuration and cannot be combined with WithLoadSimulations.");
|
|
1744
|
+
}
|
|
1715
1745
|
return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, copied, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail, this.internalLicenseFeatures);
|
|
1716
1746
|
}
|
|
1717
1747
|
/**
|
|
@@ -1722,6 +1752,9 @@ export class LoadStrikeScenario {
|
|
|
1722
1752
|
if (!simulations.length) {
|
|
1723
1753
|
throw new Error("At least one load simulation should be provided.");
|
|
1724
1754
|
}
|
|
1755
|
+
if (isCorrelateExistingTrafficTracking(this.trackingConfiguration)) {
|
|
1756
|
+
throw new Error("CorrelateExistingTraffic uses ForDuration and cannot be combined with WithLoadSimulations.");
|
|
1757
|
+
}
|
|
1725
1758
|
return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, simulations.map((simulation) => attachLoadSimulationProjection({ ...simulation })), this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail, this.internalLicenseFeatures);
|
|
1726
1759
|
}
|
|
1727
1760
|
/**
|
|
@@ -5721,6 +5754,14 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5721
5754
|
this.sourceOnlyMode = this.destinationEndpoint == null;
|
|
5722
5755
|
this.executeOriginalScenarioRun = pickTrackingBoolean(tracking, "ExecuteOriginalScenarioRun", "executeOriginalScenarioRun", false);
|
|
5723
5756
|
this.correlationTimeoutMs = Math.trunc(pickTrackingNumber(tracking, ["CorrelationTimeoutMs", "correlationTimeoutMs"], pickTrackingNumber(tracking, ["CorrelationTimeoutSeconds", "correlationTimeoutSeconds", "CorrelationTimeout"], 30) * 1000));
|
|
5757
|
+
this.observationDurationMs = Math.trunc(readObservationDurationMs(tracking));
|
|
5758
|
+
const observationCancellationSignal = pickTrackingValue(tracking, "ObservationCancellationSignal", "observationCancellationSignal");
|
|
5759
|
+
if (observationCancellationSignal !== undefined) {
|
|
5760
|
+
if (!(observationCancellationSignal instanceof AbortSignal)) {
|
|
5761
|
+
throw new TypeError("ObservationCancellationSignal must be an AbortSignal.");
|
|
5762
|
+
}
|
|
5763
|
+
this.observationCancellationSignal = observationCancellationSignal;
|
|
5764
|
+
}
|
|
5724
5765
|
this.timeoutSweepIntervalMs = Math.trunc(pickTrackingNumber(tracking, ["TimeoutSweepIntervalMs", "timeoutSweepIntervalMs"], pickTrackingNumber(tracking, ["TimeoutSweepIntervalSeconds", "timeoutSweepIntervalSeconds"], 1) * 1000));
|
|
5725
5766
|
this.timeoutBatchSize = Math.trunc(pickTrackingNumber(tracking, ["TimeoutBatchSize", "timeoutBatchSize"], 200));
|
|
5726
5767
|
this.timeoutCountsAsFailure = pickTrackingBoolean(tracking, "TimeoutCountsAsFailure", "timeoutCountsAsFailure", true);
|
|
@@ -5861,8 +5902,7 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5861
5902
|
return this.executeSourceOnly();
|
|
5862
5903
|
}
|
|
5863
5904
|
if (this.runMode === "correlateexistingtraffic") {
|
|
5864
|
-
|
|
5865
|
-
return this.toResponse(outcome);
|
|
5905
|
+
return await this.observeExistingTraffic(context.scenarioCancellationToken);
|
|
5866
5906
|
}
|
|
5867
5907
|
let producedPayload;
|
|
5868
5908
|
try {
|
|
@@ -5938,6 +5978,45 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5938
5978
|
});
|
|
5939
5979
|
return LoadStrikeResponse.ok("source_success");
|
|
5940
5980
|
}
|
|
5981
|
+
async observeExistingTraffic(signal) {
|
|
5982
|
+
const deadline = Date.now() + this.observationDurationMs;
|
|
5983
|
+
const observationSignal = this.observationCancellationSignal
|
|
5984
|
+
? combineAbortSignals(signal, this.observationCancellationSignal)
|
|
5985
|
+
: signal;
|
|
5986
|
+
let failureSeen = false;
|
|
5987
|
+
while (Date.now() < deadline && !observationSignal.aborted) {
|
|
5988
|
+
let outcome;
|
|
5989
|
+
try {
|
|
5990
|
+
outcome = await this.waitForOutcomeUntil(deadline, observationSignal);
|
|
5991
|
+
}
|
|
5992
|
+
catch (error) {
|
|
5993
|
+
if (this.observationCancellationSignal?.aborted && !signal.aborted) {
|
|
5994
|
+
break;
|
|
5995
|
+
}
|
|
5996
|
+
throw error;
|
|
5997
|
+
}
|
|
5998
|
+
if (!outcome) {
|
|
5999
|
+
break;
|
|
6000
|
+
}
|
|
6001
|
+
failureSeen = failureSeen || this.isFailedObservationOutcome(outcome);
|
|
6002
|
+
}
|
|
6003
|
+
this.shutdown = true;
|
|
6004
|
+
await Promise.all([
|
|
6005
|
+
this.sourceLoop,
|
|
6006
|
+
this.destinationLoop,
|
|
6007
|
+
this.timeoutLoop
|
|
6008
|
+
].filter(Boolean).map((value) => value.catch(() => { })));
|
|
6009
|
+
await this.correlationRuntime.sweepTimeouts(Date.now() + this.correlationTimeoutMs + 1, this.timeoutBatchSize);
|
|
6010
|
+
while (this.outcomeQueue.length > 0) {
|
|
6011
|
+
const outcome = this.outcomeQueue.shift();
|
|
6012
|
+
if (outcome) {
|
|
6013
|
+
failureSeen = failureSeen || this.isFailedObservationOutcome(outcome);
|
|
6014
|
+
}
|
|
6015
|
+
}
|
|
6016
|
+
return failureSeen
|
|
6017
|
+
? LoadStrikeResponse.fail("tracking_failures", "One or more observed source or destination events did not correlate successfully.", 0)
|
|
6018
|
+
: LoadStrikeResponse.ok("observed");
|
|
6019
|
+
}
|
|
5941
6020
|
async consumeSourceLoop() {
|
|
5942
6021
|
while (!this.shutdown) {
|
|
5943
6022
|
try {
|
|
@@ -6151,6 +6230,34 @@ class ManagedScenarioTrackingRuntime {
|
|
|
6151
6230
|
}
|
|
6152
6231
|
}
|
|
6153
6232
|
}
|
|
6233
|
+
async waitForOutcomeUntil(deadlineMs, signal) {
|
|
6234
|
+
const existing = this.outcomeQueue.shift();
|
|
6235
|
+
if (existing) {
|
|
6236
|
+
return existing;
|
|
6237
|
+
}
|
|
6238
|
+
const remainingMs = deadlineMs - Date.now();
|
|
6239
|
+
if (remainingMs <= 0) {
|
|
6240
|
+
return null;
|
|
6241
|
+
}
|
|
6242
|
+
const waiter = createManagedTrackingWaiter();
|
|
6243
|
+
this.outcomeWaiters.push(waiter);
|
|
6244
|
+
const timeout = sleep(remainingMs).then(() => null);
|
|
6245
|
+
try {
|
|
6246
|
+
return await Promise.race([waiter.promise, timeout, waitForAbort(signal)]);
|
|
6247
|
+
}
|
|
6248
|
+
finally {
|
|
6249
|
+
const index = this.outcomeWaiters.indexOf(waiter);
|
|
6250
|
+
if (index >= 0) {
|
|
6251
|
+
this.outcomeWaiters.splice(index, 1);
|
|
6252
|
+
}
|
|
6253
|
+
}
|
|
6254
|
+
}
|
|
6255
|
+
isFailedObservationOutcome(outcome) {
|
|
6256
|
+
if (outcome.status === "timeout") {
|
|
6257
|
+
return this.timeoutCountsAsFailure;
|
|
6258
|
+
}
|
|
6259
|
+
return outcome.status !== "matched";
|
|
6260
|
+
}
|
|
6154
6261
|
rejectOutstandingWaiters() {
|
|
6155
6262
|
for (const rows of this.waiters.values()) {
|
|
6156
6263
|
for (const waiter of rows) {
|
|
@@ -6270,8 +6377,12 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6270
6377
|
if (!metricPrefix.trim()) {
|
|
6271
6378
|
throw new Error("MetricPrefix must be provided.");
|
|
6272
6379
|
}
|
|
6380
|
+
const observationDurationMs = readObservationDurationMs(tracking);
|
|
6273
6381
|
validateRuntimeRedisCorrelationStoreConfiguration(tracking);
|
|
6274
6382
|
if (runMode === "generateandcorrelate") {
|
|
6383
|
+
if (observationDurationMs > 0) {
|
|
6384
|
+
throw new Error("ForDuration is only supported for CorrelateExistingTraffic.");
|
|
6385
|
+
}
|
|
6275
6386
|
if (sourceEndpoint.mode !== "Produce") {
|
|
6276
6387
|
throw new Error("Source endpoint mode must be Produce for GenerateAndCorrelate mode.");
|
|
6277
6388
|
}
|
|
@@ -6281,6 +6392,9 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6281
6392
|
return;
|
|
6282
6393
|
}
|
|
6283
6394
|
if (runMode === "correlateexistingtraffic") {
|
|
6395
|
+
if (observationDurationMs <= 0) {
|
|
6396
|
+
throw new Error("CorrelateExistingTraffic requires ForDuration with a duration greater than zero.");
|
|
6397
|
+
}
|
|
6284
6398
|
if (!destinationEndpoint) {
|
|
6285
6399
|
throw new Error("Destination endpoint must be provided for CorrelateExistingTraffic mode.");
|
|
6286
6400
|
}
|
|
@@ -6294,6 +6408,15 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6294
6408
|
}
|
|
6295
6409
|
throw new RangeError(`Unsupported tracking run mode: ${runMode}.`);
|
|
6296
6410
|
}
|
|
6411
|
+
function readObservationDurationMs(tracking) {
|
|
6412
|
+
return pickTrackingNumber(tracking, ["ObservationDurationMs", "observationDurationMs"], pickTrackingNumber(tracking, ["ObservationDurationSeconds", "observationDurationSeconds", "ObservationDuration"], 0) * 1000);
|
|
6413
|
+
}
|
|
6414
|
+
function isCorrelateExistingTrafficTracking(configuration) {
|
|
6415
|
+
if (!configuration) {
|
|
6416
|
+
return false;
|
|
6417
|
+
}
|
|
6418
|
+
return normalizeTrackingRunMode(pickTrackingString(configuration, "RunMode", "runMode", "GenerateAndCorrelate")) === "correlateexistingtraffic";
|
|
6419
|
+
}
|
|
6297
6420
|
function readUseLoadStrikeTraceIdHeader(tracking) {
|
|
6298
6421
|
return pickTrackingBoolean(tracking, "UseLoadStrikeTraceIdHeader", "useLoadStrikeTraceIdHeader", false);
|
|
6299
6422
|
}
|
|
@@ -69,6 +69,7 @@ export interface LoadStrikeTrackingConfigurationSpec {
|
|
|
69
69
|
Source: LoadStrikeEndpointSpec;
|
|
70
70
|
Destination?: LoadStrikeEndpointSpec;
|
|
71
71
|
RunMode?: string;
|
|
72
|
+
ObservationDurationSeconds?: number;
|
|
72
73
|
CorrelationTimeoutSeconds?: number;
|
|
73
74
|
TimeoutSweepIntervalSeconds?: number;
|
|
74
75
|
TimeoutBatchSize?: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export type { LoadStrikeDateValue, LoadStrikeObject, LoadStrikeRunContext as Loa
|
|
|
2
2
|
export { LoadStrikeAutopilot, LoadStrikeAutopilotResult } from "./autopilot.js";
|
|
3
3
|
export type { LoadStrikeAutopilotEndpoint, LoadStrikeAutopilotEndpointBinding, LoadStrikeAutopilotLoadSimulationSuggestion, LoadStrikeAutopilotMessageSample, LoadStrikeAutopilotOptions, LoadStrikeAutopilotPlan, LoadStrikeAutopilotPreviewReport, LoadStrikeAutopilotReadinessFailure, LoadStrikeAutopilotRedaction, LoadStrikeAutopilotRequest, LoadStrikeAutopilotResultShape, LoadStrikeAutopilotScenarioPlan, LoadStrikeAutopilotSecretBinding, LoadStrikeAutopilotThresholdSuggestion, LoadStrikeAutopilotTrackingSelectorSuggestion } from "./autopilot-contracts.js";
|
|
4
4
|
export { LoadStrikeAutopilotReadiness } from "./autopilot-contracts.js";
|
|
5
|
-
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
6
|
-
export type { ILoadStrikeReportingSink, ILoadStrikeWorkerPlugin, LoadStrikeRunResult, LoadStrikeReportingSink, LoadStrikeRuntimePolicy, LoadStrikeRunnerOptions, LoadStrikeRunContext as LoadStrikeRuntimeContext, LoadStrikeRunContext, LoadStrikeBaseContext, LoadStrikeCounterStats, LoadStrikeDataTransferStats, LoadStrikeGaugeStats, LoadStrikeLogger, LoadStrikeLoadSimulationStats, LoadStrikeMeasurementStats, LoadStrikeMetricStats, LoadStrikeNodeInfo, LoadStrikeMetricValue, LoadStrikeRandom, LoadStrikeReply, LoadStrikeLatencyCount, LoadStrikeLatencyStats, LoadStrikeLoadSimulation, LoadStrikeScenarioInfo, LoadStrikeScenarioInitContext, LoadStrikeScenarioPartition, LoadStrikeScenarioStartInfo, LoadStrikeScenarioContext, LoadStrikeScenarioStats, LoadStrikeTestInfo, LoadStrikeScenarioRuntime, LoadStrikeSessionStartInfo, LoadStrikeSinkSession, LoadStrikeSinkError, LoadStrikeStatusCodeStats, LoadStrikeThresholdResult, LoadStrikeThresholdPredicateContext,
|
|
5
|
+
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation, CrossPlatformTrackingConfiguration, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
6
|
+
export type { ILoadStrikeReportingSink, ILoadStrikeWorkerPlugin, LoadStrikeRunResult, LoadStrikeReportingSink, LoadStrikeRuntimePolicy, LoadStrikeRunnerOptions, LoadStrikeRunContext as LoadStrikeRuntimeContext, LoadStrikeRunContext, LoadStrikeBaseContext, LoadStrikeCounterStats, LoadStrikeDataTransferStats, LoadStrikeGaugeStats, LoadStrikeLogger, LoadStrikeLoadSimulationStats, LoadStrikeMeasurementStats, LoadStrikeMetricStats, LoadStrikeNodeInfo, LoadStrikeMetricValue, LoadStrikeRandom, LoadStrikeReply, LoadStrikeLatencyCount, LoadStrikeLatencyStats, LoadStrikeLoadSimulation, LoadStrikeScenarioInfo, LoadStrikeScenarioInitContext, LoadStrikeScenarioPartition, LoadStrikeScenarioStartInfo, LoadStrikeScenarioContext, LoadStrikeScenarioStats, LoadStrikeTestInfo, LoadStrikeScenarioRuntime, LoadStrikeSessionStartInfo, LoadStrikeSinkSession, LoadStrikeSinkError, LoadStrikeStatusCodeStats, LoadStrikeThresholdResult, LoadStrikeThresholdPredicateContext, LoadStrikeStepReply, LoadStrikeStepStats, LoadStrikeStepRuntime, LoadStrikeThresholdOptions, LoadStrikeRequestStats, LoadStrikeWorkerPlugin } from "./runtime.js";
|
|
7
7
|
export { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, InMemoryCorrelationStore, RedisCorrelationStoreOptions, RedisCorrelationStore, TrackingPayloadBuilder, TrackingFieldSelector } from "./correlation.js";
|
|
8
8
|
export type { CorrelationEntry, DestinationConsumeResult, GatheredRow, CorrelationStoreKind, CorrelationRuntimeOptions, CorrelationRuntimePlugin, CorrelationRuntimeStats, CorrelationStore, SourceProduceResult, TrackingFieldLocation, TrackingPayload } from "./correlation.js";
|
|
9
9
|
export { EndpointAdapterFactory, LOADSTRIKE_TRACE_ID_HEADER, LOADSTRIKE_TRACE_ID_TRACKING_FIELD, TrafficEndpointDefinition, HttpEndpointDefinition, KafkaEndpointDefinition, KafkaSaslOptions, RabbitMqEndpointDefinition, NatsEndpointDefinition, RedisStreamsEndpointDefinition, AzureEventHubsEndpointDefinition, DelegateStreamEndpointDefinition, PushDiffusionEndpointDefinition, HttpOAuth2ClientCredentialsOptions, HttpAuthOptions } from "./transports.js";
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -43,6 +43,10 @@ export declare const LoadStrikeOperationType: {
|
|
|
43
43
|
export type LoadStrikeOperationType = typeof LoadStrikeOperationType[keyof typeof LoadStrikeOperationType];
|
|
44
44
|
export type LoadStrikeLoadSimulation = Record<string, unknown>;
|
|
45
45
|
export type CrossPlatformTrackingConfiguration = Record<string, unknown>;
|
|
46
|
+
export declare const CrossPlatformTrackingConfiguration: {
|
|
47
|
+
readonly forDuration: (configuration: Record<string, unknown>, durationSeconds: number, cancellationSignal?: AbortSignal) => CrossPlatformTrackingConfiguration;
|
|
48
|
+
readonly ForDuration: (configuration: Record<string, unknown>, durationSeconds: number, cancellationSignal?: AbortSignal) => CrossPlatformTrackingConfiguration;
|
|
49
|
+
};
|
|
46
50
|
export interface LoadStrikeRandom {
|
|
47
51
|
next(): number;
|
|
48
52
|
next(maxValue: number): number;
|
|
@@ -2056,6 +2060,8 @@ declare class ManagedScenarioTrackingRuntime {
|
|
|
2056
2060
|
private readonly sourceOnlyMode;
|
|
2057
2061
|
private readonly executeOriginalScenarioRun;
|
|
2058
2062
|
private readonly correlationTimeoutMs;
|
|
2063
|
+
private readonly observationDurationMs;
|
|
2064
|
+
private readonly observationCancellationSignal?;
|
|
2059
2065
|
private readonly timeoutSweepIntervalMs;
|
|
2060
2066
|
private readonly timeoutBatchSize;
|
|
2061
2067
|
private readonly timeoutCountsAsFailure;
|
|
@@ -2078,6 +2084,7 @@ declare class ManagedScenarioTrackingRuntime {
|
|
|
2078
2084
|
executeIteration(context: InternalScenarioContext, originalRun: () => Promise<LoadStrikeStepReply>, _operation: "WarmUp" | "Bombing"): Promise<LoadStrikeStepReply>;
|
|
2079
2085
|
dispose(): Promise<void>;
|
|
2080
2086
|
private executeSourceOnly;
|
|
2087
|
+
private observeExistingTraffic;
|
|
2081
2088
|
private consumeSourceLoop;
|
|
2082
2089
|
private consumeDestinationLoop;
|
|
2083
2090
|
private runTimeoutSweepLoop;
|
|
@@ -2090,6 +2097,8 @@ declare class ManagedScenarioTrackingRuntime {
|
|
|
2090
2097
|
private resolveTrackingWaiter;
|
|
2091
2098
|
private pushOutcome;
|
|
2092
2099
|
private waitForOutcome;
|
|
2100
|
+
private waitForOutcomeUntil;
|
|
2101
|
+
private isFailedObservationOutcome;
|
|
2093
2102
|
private rejectOutstandingWaiters;
|
|
2094
2103
|
}
|
|
2095
2104
|
declare function buildTrackingLeaseKey(sessionId: string, scenarioName: string, tracking: Record<string, unknown>): string;
|
package/package.json
CHANGED