@loadstrike/loadstrike-sdk 1.0.22001 → 1.0.22301
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 +4 -2
- package/dist/cjs/local.js +10 -6
- package/dist/cjs/runtime.js +23 -13
- package/dist/cjs/transports.js +16 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/local.js +11 -7
- package/dist/esm/runtime.js +25 -15
- package/dist/esm/transports.js +15 -3
- package/dist/types/contracts.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/local.d.ts +1 -1
- package/dist/types/runtime.d.ts +1 -1
- package/dist/types/transports.d.ts +3 -1
- 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 = void 0;
|
|
3
|
+
exports.InfluxDbReportingSinkOptions = 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.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 = 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; } });
|
|
@@ -37,6 +37,8 @@ Object.defineProperty(exports, "TrackingPayloadBuilder", { enumerable: true, get
|
|
|
37
37
|
Object.defineProperty(exports, "TrackingFieldSelector", { enumerable: true, get: function () { return correlation_js_1.TrackingFieldSelector; } });
|
|
38
38
|
var transports_js_1 = require("./transports.js");
|
|
39
39
|
Object.defineProperty(exports, "EndpointAdapterFactory", { enumerable: true, get: function () { return transports_js_1.EndpointAdapterFactory; } });
|
|
40
|
+
Object.defineProperty(exports, "LOADSTRIKE_TRACE_ID_HEADER", { enumerable: true, get: function () { return transports_js_1.LOADSTRIKE_TRACE_ID_HEADER; } });
|
|
41
|
+
Object.defineProperty(exports, "LOADSTRIKE_TRACE_ID_TRACKING_FIELD", { enumerable: true, get: function () { return transports_js_1.LOADSTRIKE_TRACE_ID_TRACKING_FIELD; } });
|
|
40
42
|
Object.defineProperty(exports, "TrafficEndpointDefinition", { enumerable: true, get: function () { return transports_js_1.TrafficEndpointDefinition; } });
|
|
41
43
|
Object.defineProperty(exports, "HttpEndpointDefinition", { enumerable: true, get: function () { return transports_js_1.HttpEndpointDefinition; } });
|
|
42
44
|
Object.defineProperty(exports, "KafkaEndpointDefinition", { enumerable: true, get: function () { return transports_js_1.KafkaEndpointDefinition; } });
|
package/dist/cjs/local.js
CHANGED
|
@@ -850,10 +850,11 @@ async function evaluateScenarioOutcome(scenario, requestCount, context) {
|
|
|
850
850
|
if (!Object.keys(sourceSpec).length) {
|
|
851
851
|
return { requestCount, okCount: requestCount, failCount: 0 };
|
|
852
852
|
}
|
|
853
|
-
const
|
|
853
|
+
const useLoadStrikeTraceIdHeader = toBoolean(pickValue(tracking, "UseLoadStrikeTraceIdHeader", "useLoadStrikeTraceIdHeader"), false);
|
|
854
|
+
const sourceEndpoint = mapEndpointSpec(sourceSpec, useLoadStrikeTraceIdHeader);
|
|
854
855
|
const destinationSpec = asRecord(tracking.Destination);
|
|
855
856
|
const hasDestination = Object.keys(destinationSpec).length > 0;
|
|
856
|
-
const destinationEndpoint = hasDestination ? mapEndpointSpec(destinationSpec) : null;
|
|
857
|
+
const destinationEndpoint = hasDestination ? mapEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader) : null;
|
|
857
858
|
validateTrackingConfiguration(tracking, sourceEndpoint, destinationEndpoint);
|
|
858
859
|
const sourceAdapter = transports_js_1.EndpointAdapterFactory.create(sourceEndpoint);
|
|
859
860
|
const destinationAdapter = destinationEndpoint ? transports_js_1.EndpointAdapterFactory.create(destinationEndpoint) : null;
|
|
@@ -1109,7 +1110,7 @@ function inferLegacyHttpResponseSourceValue(value) {
|
|
|
1109
1110
|
return undefined;
|
|
1110
1111
|
}
|
|
1111
1112
|
}
|
|
1112
|
-
function mapEndpointSpec(spec) {
|
|
1113
|
+
function mapEndpointSpec(spec, useLoadStrikeTraceIdHeader = false) {
|
|
1113
1114
|
const pollIntervalOverride = pickValue(spec, "PollIntervalMs", "pollIntervalMs");
|
|
1114
1115
|
const pollIntervalSeconds = pickValue(spec, "PollIntervalSeconds", "pollIntervalSeconds", "PollInterval");
|
|
1115
1116
|
const pollIntervalMs = pollIntervalOverride != null && String(pollIntervalOverride).trim() !== ""
|
|
@@ -1142,7 +1143,7 @@ function mapEndpointSpec(spec) {
|
|
|
1142
1143
|
kind: stringOrDefault(pickValue(spec, "Kind", "kind"), "DelegateStream"),
|
|
1143
1144
|
mode: stringOrDefault(pickValue(spec, "Mode", "mode"), "Produce"),
|
|
1144
1145
|
name: stringOrDefault(pickValue(spec, "Name", "name"), "endpoint"),
|
|
1145
|
-
trackingField: readTrackingSelectorValue(pickValue(spec, "TrackingField", "trackingField"), "header:x-correlation-id"),
|
|
1146
|
+
trackingField: readTrackingSelectorValue(pickValue(spec, "TrackingField", "trackingField"), useLoadStrikeTraceIdHeader ? transports_js_1.LOADSTRIKE_TRACE_ID_TRACKING_FIELD : "header:x-correlation-id"),
|
|
1146
1147
|
gatherByField: readOptionalTrackingSelectorValue(pickValue(spec, "GatherByField", "gatherByField")),
|
|
1147
1148
|
autoGenerateTrackingIdWhenMissing: toBoolean(pickValue(spec, "AutoGenerateTrackingIdWhenMissing", "autoGenerateTrackingIdWhenMissing"), true),
|
|
1148
1149
|
pollIntervalMs,
|
|
@@ -1242,10 +1243,13 @@ function normalizePayload(payload, endpoint, index) {
|
|
|
1242
1243
|
return normalized;
|
|
1243
1244
|
}
|
|
1244
1245
|
const existing = readTrackingId(normalized, selector);
|
|
1245
|
-
|
|
1246
|
+
const endpointMode = String(endpoint.mode ?? "Produce").trim().toLowerCase();
|
|
1247
|
+
if (existing || endpointMode === "consume" || !endpoint.autoGenerateTrackingIdWhenMissing) {
|
|
1246
1248
|
return normalized;
|
|
1247
1249
|
}
|
|
1248
|
-
const generated =
|
|
1250
|
+
const generated = selector.toLowerCase() === transports_js_1.LOADSTRIKE_TRACE_ID_TRACKING_FIELD
|
|
1251
|
+
? (0, node_crypto_1.randomUUID)()
|
|
1252
|
+
: `${endpoint.name}-auto-${index + 1}`;
|
|
1249
1253
|
if (selector.toLowerCase().startsWith("header:")) {
|
|
1250
1254
|
const headerName = selector.slice("header:".length).trim();
|
|
1251
1255
|
if (headerName) {
|
package/dist/cjs/runtime.js
CHANGED
|
@@ -1724,9 +1724,10 @@ class LoadStrikeScenario {
|
|
|
1724
1724
|
throw new Error("Tracking source endpoint must be provided.");
|
|
1725
1725
|
}
|
|
1726
1726
|
const destinationSpec = asTrackingRecord(pickTrackingValue(copied, "Destination", "destination"));
|
|
1727
|
-
const
|
|
1727
|
+
const useLoadStrikeTraceIdHeader = readUseLoadStrikeTraceIdHeader(copied);
|
|
1728
|
+
const sourceEndpoint = mapRuntimeTrackingEndpointSpec(sourceSpec, useLoadStrikeTraceIdHeader);
|
|
1728
1729
|
const destinationEndpoint = Object.keys(destinationSpec).length
|
|
1729
|
-
? mapRuntimeTrackingEndpointSpec(destinationSpec)
|
|
1730
|
+
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
1730
1731
|
: null;
|
|
1731
1732
|
validateRuntimeTrackingConfiguration(copied, sourceEndpoint, destinationEndpoint);
|
|
1732
1733
|
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);
|
|
@@ -5730,9 +5731,10 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5730
5731
|
this.timeoutLoop = null;
|
|
5731
5732
|
const sourceSpec = asTrackingRecord(pickTrackingValue(tracking, "Source", "source"));
|
|
5732
5733
|
const destinationSpec = asTrackingRecord(pickTrackingValue(tracking, "Destination", "destination"));
|
|
5733
|
-
|
|
5734
|
+
const useLoadStrikeTraceIdHeader = readUseLoadStrikeTraceIdHeader(tracking);
|
|
5735
|
+
this.sourceEndpoint = mapRuntimeTrackingEndpointSpec(sourceSpec, useLoadStrikeTraceIdHeader);
|
|
5734
5736
|
this.destinationEndpoint = Object.keys(destinationSpec).length
|
|
5735
|
-
? mapRuntimeTrackingEndpointSpec(destinationSpec)
|
|
5737
|
+
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
5736
5738
|
: null;
|
|
5737
5739
|
validateRuntimeTrackingConfiguration(tracking, this.sourceEndpoint, this.destinationEndpoint);
|
|
5738
5740
|
this.runMode = normalizeTrackingRunMode(pickTrackingString(tracking, "RunMode", "runMode", "GenerateAndCorrelate"));
|
|
@@ -6227,9 +6229,12 @@ function getScenarioTrackingRuntime(context, tracking) {
|
|
|
6227
6229
|
return lease.runtime;
|
|
6228
6230
|
}
|
|
6229
6231
|
function buildTrackingLeaseKey(sessionId, scenarioName, tracking) {
|
|
6230
|
-
const
|
|
6232
|
+
const useLoadStrikeTraceIdHeader = readUseLoadStrikeTraceIdHeader(tracking);
|
|
6233
|
+
const source = mapRuntimeTrackingEndpointSpec(asTrackingRecord(pickTrackingValue(tracking, "Source", "source")), useLoadStrikeTraceIdHeader);
|
|
6231
6234
|
const destinationSpec = asTrackingRecord(pickTrackingValue(tracking, "Destination", "destination"));
|
|
6232
|
-
const destination = Object.keys(destinationSpec).length
|
|
6235
|
+
const destination = Object.keys(destinationSpec).length
|
|
6236
|
+
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
6237
|
+
: null;
|
|
6233
6238
|
const runMode = normalizeTrackingRunMode(pickTrackingString(tracking, "RunMode", "runMode", "GenerateAndCorrelate"));
|
|
6234
6239
|
return `${sessionId}|${scenarioName}|${source.name}|${destination?.name ?? "<source-only>"}|${runMode}`;
|
|
6235
6240
|
}
|
|
@@ -6309,6 +6314,9 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6309
6314
|
}
|
|
6310
6315
|
throw new RangeError(`Unsupported tracking run mode: ${runMode}.`);
|
|
6311
6316
|
}
|
|
6317
|
+
function readUseLoadStrikeTraceIdHeader(tracking) {
|
|
6318
|
+
return pickTrackingBoolean(tracking, "UseLoadStrikeTraceIdHeader", "useLoadStrikeTraceIdHeader", false);
|
|
6319
|
+
}
|
|
6312
6320
|
function validateRuntimeRedisCorrelationStoreConfiguration(tracking) {
|
|
6313
6321
|
const storeSpec = asTrackingRecord(pickTrackingValue(tracking, "CorrelationStore", "correlationStore"));
|
|
6314
6322
|
const kind = pickTrackingString(storeSpec, "Kind", "kind", "").trim().toLowerCase();
|
|
@@ -6392,12 +6400,12 @@ function sanitizeTrackingNamespacePart(value) {
|
|
|
6392
6400
|
.replace(/\s+/g, "_");
|
|
6393
6401
|
}
|
|
6394
6402
|
async function produceOrConsumeTrackingPayload(adapter, endpoint, runMode, index) {
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
return normalizeRuntimeTrackingPayload(
|
|
6403
|
+
if (runMode === "correlateexistingtraffic") {
|
|
6404
|
+
return normalizeRuntimeObservedTrackingPayload(await adapter.consume(), endpoint);
|
|
6405
|
+
}
|
|
6406
|
+
return normalizeRuntimeTrackingPayload(await adapter.produce(), endpoint, index);
|
|
6399
6407
|
}
|
|
6400
|
-
function mapRuntimeTrackingEndpointSpec(spec) {
|
|
6408
|
+
function mapRuntimeTrackingEndpointSpec(spec, useLoadStrikeTraceIdHeader = false) {
|
|
6401
6409
|
const pollIntervalMs = Math.trunc(pickTrackingNumber(spec, ["PollIntervalMs", "pollIntervalMs"], pickTrackingNumber(spec, ["PollIntervalSeconds", "pollIntervalSeconds", "PollInterval"], 0.25) * 1000));
|
|
6402
6410
|
const httpSpec = asTrackingRecord(pickTrackingValue(spec, "Http", "http"));
|
|
6403
6411
|
const delegateSpec = asTrackingRecord(pickTrackingValue(spec, "delegate", "Delegate", "DelegateStream"));
|
|
@@ -6424,7 +6432,7 @@ function mapRuntimeTrackingEndpointSpec(spec) {
|
|
|
6424
6432
|
kind: pickTrackingString(spec, "Kind", "kind", "DelegateStream"),
|
|
6425
6433
|
mode: pickTrackingString(spec, "Mode", "mode", "Produce"),
|
|
6426
6434
|
name: pickTrackingString(spec, "Name", "name", "endpoint"),
|
|
6427
|
-
trackingField: pickTrackingSelectorString(spec, "TrackingField", "trackingField", "header:x-correlation-id"),
|
|
6435
|
+
trackingField: pickTrackingSelectorString(spec, "TrackingField", "trackingField", useLoadStrikeTraceIdHeader ? transports_js_1.LOADSTRIKE_TRACE_ID_TRACKING_FIELD : "header:x-correlation-id"),
|
|
6428
6436
|
gatherByField: pickOptionalTrackingSelectorString(spec, "GatherByField", "gatherByField"),
|
|
6429
6437
|
autoGenerateTrackingIdWhenMissing: pickTrackingBoolean(spec, "AutoGenerateTrackingIdWhenMissing", "autoGenerateTrackingIdWhenMissing", true),
|
|
6430
6438
|
pollIntervalMs,
|
|
@@ -6530,7 +6538,9 @@ function normalizeRuntimeTrackingPayload(payload, endpoint, index) {
|
|
|
6530
6538
|
if (existing || !endpoint.autoGenerateTrackingIdWhenMissing) {
|
|
6531
6539
|
return normalized;
|
|
6532
6540
|
}
|
|
6533
|
-
const generated =
|
|
6541
|
+
const generated = endpoint.trackingField.trim().toLowerCase() === transports_js_1.LOADSTRIKE_TRACE_ID_TRACKING_FIELD
|
|
6542
|
+
? (0, node_crypto_1.randomUUID)()
|
|
6543
|
+
: `${endpoint.name}-auto-${index + 1}`;
|
|
6534
6544
|
const selector = endpoint.trackingField.trim();
|
|
6535
6545
|
if (selector.toLowerCase().startsWith("header:")) {
|
|
6536
6546
|
const headerName = selector.slice("header:".length).trim();
|
package/dist/cjs/transports.js
CHANGED
|
@@ -33,9 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.__loadstrikeTestExports = exports.EndpointAdapterFactory = exports.KafkaSaslOptions = exports.HttpAuthOptions = exports.HttpOAuth2ClientCredentialsOptions = exports.PushDiffusionEndpointDefinition = exports.DelegateStreamEndpointDefinition = exports.AzureEventHubsEndpointDefinition = exports.RedisStreamsEndpointDefinition = exports.NatsEndpointDefinition = exports.RabbitMqEndpointDefinition = exports.KafkaEndpointDefinition = exports.HttpEndpointDefinition = exports.TrafficEndpointDefinition = void 0;
|
|
36
|
+
exports.__loadstrikeTestExports = exports.EndpointAdapterFactory = exports.KafkaSaslOptions = exports.HttpAuthOptions = exports.HttpOAuth2ClientCredentialsOptions = exports.PushDiffusionEndpointDefinition = exports.DelegateStreamEndpointDefinition = exports.AzureEventHubsEndpointDefinition = exports.RedisStreamsEndpointDefinition = exports.NatsEndpointDefinition = exports.RabbitMqEndpointDefinition = exports.KafkaEndpointDefinition = exports.HttpEndpointDefinition = exports.TrafficEndpointDefinition = exports.LOADSTRIKE_TRACE_ID_TRACKING_FIELD = exports.LOADSTRIKE_TRACE_ID_HEADER = void 0;
|
|
37
37
|
const node_crypto_1 = require("node:crypto");
|
|
38
38
|
const correlation_js_1 = require("./correlation.js");
|
|
39
|
+
exports.LOADSTRIKE_TRACE_ID_HEADER = "loadstrike-trace-id";
|
|
40
|
+
exports.LOADSTRIKE_TRACE_ID_TRACKING_FIELD = `header:${exports.LOADSTRIKE_TRACE_ID_HEADER}`;
|
|
39
41
|
class TrafficEndpointDefinitionModel {
|
|
40
42
|
get JsonSerializerSettings() {
|
|
41
43
|
return this.JsonSettings;
|
|
@@ -1084,8 +1086,9 @@ class HttpEndpointAdapter extends CallbackAdapter {
|
|
|
1084
1086
|
if (this.endpoint.mode !== "Produce") {
|
|
1085
1087
|
return null;
|
|
1086
1088
|
}
|
|
1087
|
-
const resolved = payload ?? this.defaultPayload();
|
|
1088
1089
|
const httpOptions = this.endpoint.http;
|
|
1090
|
+
const responseTracking = canonicalizeHttpTrackingPayloadSource(String(httpOptions?.trackingPayloadSource ?? "Request")) === "Response";
|
|
1091
|
+
const resolved = prepareProducedPayload(this.endpoint, payload, !responseTracking);
|
|
1089
1092
|
if (!httpOptions?.url) {
|
|
1090
1093
|
return super.produce(resolved);
|
|
1091
1094
|
}
|
|
@@ -2988,7 +2991,7 @@ function createDefaultPayload(endpoint) {
|
|
|
2988
2991
|
jsonConvertSettings: endpoint.jsonConvertSettings ? { ...endpoint.jsonConvertSettings } : undefined
|
|
2989
2992
|
});
|
|
2990
2993
|
}
|
|
2991
|
-
function prepareProducedPayload(endpoint, payload) {
|
|
2994
|
+
function prepareProducedPayload(endpoint, payload, allowAutoGenerateTrackingId = true) {
|
|
2992
2995
|
const base = payload
|
|
2993
2996
|
? attachPayloadHelpers({
|
|
2994
2997
|
headers: {
|
|
@@ -3007,15 +3010,24 @@ function prepareProducedPayload(endpoint, payload) {
|
|
|
3007
3010
|
if (trackingId) {
|
|
3008
3011
|
return base;
|
|
3009
3012
|
}
|
|
3013
|
+
if (!allowAutoGenerateTrackingId) {
|
|
3014
|
+
return base;
|
|
3015
|
+
}
|
|
3010
3016
|
if (endpoint.autoGenerateTrackingIdWhenMissing === false) {
|
|
3011
3017
|
throw new Error(`Tracking id could not be extracted using selector \`${endpoint.trackingField}\` and AutoGenerateTrackingIdWhenMissing is disabled for endpoint \`${endpoint.name}\`.`);
|
|
3012
3018
|
}
|
|
3013
|
-
const generated = (
|
|
3019
|
+
const generated = isLoadStrikeTraceSelector(endpoint.trackingField)
|
|
3020
|
+
? (0, node_crypto_1.randomUUID)()
|
|
3021
|
+
: (0, node_crypto_1.randomUUID)().replace(/-/g, "");
|
|
3014
3022
|
if (!injectTrackingValue(base, endpoint.trackingField, generated)) {
|
|
3015
3023
|
throw new Error(`Tracking id could not be injected using selector \`${endpoint.trackingField}\` for endpoint \`${endpoint.name}\`. Verify the selector and payload shape.`);
|
|
3016
3024
|
}
|
|
3017
3025
|
return base;
|
|
3018
3026
|
}
|
|
3027
|
+
function isLoadStrikeTraceSelector(selector) {
|
|
3028
|
+
const trimmed = selector.trim();
|
|
3029
|
+
return trimmed.toLowerCase() === exports.LOADSTRIKE_TRACE_ID_TRACKING_FIELD;
|
|
3030
|
+
}
|
|
3019
3031
|
function toWirePayload(payload, endpoint) {
|
|
3020
3032
|
return {
|
|
3021
3033
|
headers: { ...(payload.headers ?? {}) },
|
package/dist/esm/index.js
CHANGED
|
@@ -2,5 +2,5 @@ export { LoadStrikeAutopilot, LoadStrikeAutopilotResult } from "./autopilot.js";
|
|
|
2
2
|
export { LoadStrikeAutopilotReadiness } from "./autopilot-contracts.js";
|
|
3
3
|
export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStrikeContext, LoadStrikePluginData, LoadStrikePluginDataTable, LoadStrikeNodeType, LoadStrikeReportFormat, LoadStrikeResponse, LoadStrikeLogLevel, LoadStrikeScenarioOperation, LoadStrikeOperationType, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation, LoadStrikeMetric, LoadStrikeCounter, LoadStrikeGauge, LoadStrikeStep, LoadStrikeThreshold } from "./runtime.js";
|
|
4
4
|
export { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, InMemoryCorrelationStore, RedisCorrelationStoreOptions, RedisCorrelationStore, TrackingPayloadBuilder, TrackingFieldSelector } from "./correlation.js";
|
|
5
|
-
export { EndpointAdapterFactory, TrafficEndpointDefinition, HttpEndpointDefinition, KafkaEndpointDefinition, KafkaSaslOptions, RabbitMqEndpointDefinition, NatsEndpointDefinition, RedisStreamsEndpointDefinition, AzureEventHubsEndpointDefinition, DelegateStreamEndpointDefinition, PushDiffusionEndpointDefinition, HttpOAuth2ClientCredentialsOptions, HttpAuthOptions } from "./transports.js";
|
|
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
|
@@ -3,7 +3,7 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as childProcess from "node:child_process";
|
|
4
4
|
import { createHash, createVerify, randomUUID } from "node:crypto";
|
|
5
5
|
import { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, RedisCorrelationStoreOptions, RedisCorrelationStore, TrackingFieldSelector } from "./correlation.js";
|
|
6
|
-
import { EndpointAdapterFactory } from "./transports.js";
|
|
6
|
+
import { EndpointAdapterFactory, LOADSTRIKE_TRACE_ID_TRACKING_FIELD } from "./transports.js";
|
|
7
7
|
const DEFAULT_LICENSING_API_BASE_URL = "https://licensing.loadstrike.com";
|
|
8
8
|
const INTERNAL_BLACKBOX_LICENSING_API_BASE_URL_ENVIRONMENT_VARIABLE = "LOADSTRIKE_INTERNAL_BLACKBOX_API_BASE_URL";
|
|
9
9
|
let developmentLicensingApiBaseUrlOverride;
|
|
@@ -810,10 +810,11 @@ async function evaluateScenarioOutcome(scenario, requestCount, context) {
|
|
|
810
810
|
if (!Object.keys(sourceSpec).length) {
|
|
811
811
|
return { requestCount, okCount: requestCount, failCount: 0 };
|
|
812
812
|
}
|
|
813
|
-
const
|
|
813
|
+
const useLoadStrikeTraceIdHeader = toBoolean(pickValue(tracking, "UseLoadStrikeTraceIdHeader", "useLoadStrikeTraceIdHeader"), false);
|
|
814
|
+
const sourceEndpoint = mapEndpointSpec(sourceSpec, useLoadStrikeTraceIdHeader);
|
|
814
815
|
const destinationSpec = asRecord(tracking.Destination);
|
|
815
816
|
const hasDestination = Object.keys(destinationSpec).length > 0;
|
|
816
|
-
const destinationEndpoint = hasDestination ? mapEndpointSpec(destinationSpec) : null;
|
|
817
|
+
const destinationEndpoint = hasDestination ? mapEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader) : null;
|
|
817
818
|
validateTrackingConfiguration(tracking, sourceEndpoint, destinationEndpoint);
|
|
818
819
|
const sourceAdapter = EndpointAdapterFactory.create(sourceEndpoint);
|
|
819
820
|
const destinationAdapter = destinationEndpoint ? EndpointAdapterFactory.create(destinationEndpoint) : null;
|
|
@@ -1069,7 +1070,7 @@ function inferLegacyHttpResponseSourceValue(value) {
|
|
|
1069
1070
|
return undefined;
|
|
1070
1071
|
}
|
|
1071
1072
|
}
|
|
1072
|
-
function mapEndpointSpec(spec) {
|
|
1073
|
+
function mapEndpointSpec(spec, useLoadStrikeTraceIdHeader = false) {
|
|
1073
1074
|
const pollIntervalOverride = pickValue(spec, "PollIntervalMs", "pollIntervalMs");
|
|
1074
1075
|
const pollIntervalSeconds = pickValue(spec, "PollIntervalSeconds", "pollIntervalSeconds", "PollInterval");
|
|
1075
1076
|
const pollIntervalMs = pollIntervalOverride != null && String(pollIntervalOverride).trim() !== ""
|
|
@@ -1102,7 +1103,7 @@ function mapEndpointSpec(spec) {
|
|
|
1102
1103
|
kind: stringOrDefault(pickValue(spec, "Kind", "kind"), "DelegateStream"),
|
|
1103
1104
|
mode: stringOrDefault(pickValue(spec, "Mode", "mode"), "Produce"),
|
|
1104
1105
|
name: stringOrDefault(pickValue(spec, "Name", "name"), "endpoint"),
|
|
1105
|
-
trackingField: readTrackingSelectorValue(pickValue(spec, "TrackingField", "trackingField"), "header:x-correlation-id"),
|
|
1106
|
+
trackingField: readTrackingSelectorValue(pickValue(spec, "TrackingField", "trackingField"), useLoadStrikeTraceIdHeader ? LOADSTRIKE_TRACE_ID_TRACKING_FIELD : "header:x-correlation-id"),
|
|
1106
1107
|
gatherByField: readOptionalTrackingSelectorValue(pickValue(spec, "GatherByField", "gatherByField")),
|
|
1107
1108
|
autoGenerateTrackingIdWhenMissing: toBoolean(pickValue(spec, "AutoGenerateTrackingIdWhenMissing", "autoGenerateTrackingIdWhenMissing"), true),
|
|
1108
1109
|
pollIntervalMs,
|
|
@@ -1202,10 +1203,13 @@ function normalizePayload(payload, endpoint, index) {
|
|
|
1202
1203
|
return normalized;
|
|
1203
1204
|
}
|
|
1204
1205
|
const existing = readTrackingId(normalized, selector);
|
|
1205
|
-
|
|
1206
|
+
const endpointMode = String(endpoint.mode ?? "Produce").trim().toLowerCase();
|
|
1207
|
+
if (existing || endpointMode === "consume" || !endpoint.autoGenerateTrackingIdWhenMissing) {
|
|
1206
1208
|
return normalized;
|
|
1207
1209
|
}
|
|
1208
|
-
const generated =
|
|
1210
|
+
const generated = selector.toLowerCase() === LOADSTRIKE_TRACE_ID_TRACKING_FIELD
|
|
1211
|
+
? randomUUID()
|
|
1212
|
+
: `${endpoint.name}-auto-${index + 1}`;
|
|
1209
1213
|
if (selector.toLowerCase().startsWith("header:")) {
|
|
1210
1214
|
const headerName = selector.slice("header:".length).trim();
|
|
1211
1215
|
if (headerName) {
|
package/dist/esm/runtime.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { randomBytes, randomUUID } from "node:crypto";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { LoadStrikeLocalClient } from "./local.js";
|
|
6
6
|
import { DistributedClusterAgent, DistributedClusterCoordinator } from "./cluster.js";
|
|
7
7
|
import { CorrelationStoreConfiguration, CrossPlatformTrackingRuntime, RedisCorrelationStore, RedisCorrelationStoreOptions, TrackingFieldSelector } from "./correlation.js";
|
|
8
|
-
import { EndpointAdapterFactory } from "./transports.js";
|
|
8
|
+
import { EndpointAdapterFactory, LOADSTRIKE_TRACE_ID_TRACKING_FIELD } from "./transports.js";
|
|
9
9
|
import { buildDotnetCsvReport, buildDotnetHtmlReport, buildDotnetMarkdownReport, buildDotnetTxtReport } from "./reporting.js";
|
|
10
10
|
export const LoadStrikeNodeType = {
|
|
11
11
|
SingleNode: "SingleNode",
|
|
@@ -1706,9 +1706,10 @@ export class LoadStrikeScenario {
|
|
|
1706
1706
|
throw new Error("Tracking source endpoint must be provided.");
|
|
1707
1707
|
}
|
|
1708
1708
|
const destinationSpec = asTrackingRecord(pickTrackingValue(copied, "Destination", "destination"));
|
|
1709
|
-
const
|
|
1709
|
+
const useLoadStrikeTraceIdHeader = readUseLoadStrikeTraceIdHeader(copied);
|
|
1710
|
+
const sourceEndpoint = mapRuntimeTrackingEndpointSpec(sourceSpec, useLoadStrikeTraceIdHeader);
|
|
1710
1711
|
const destinationEndpoint = Object.keys(destinationSpec).length
|
|
1711
|
-
? mapRuntimeTrackingEndpointSpec(destinationSpec)
|
|
1712
|
+
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
1712
1713
|
: null;
|
|
1713
1714
|
validateRuntimeTrackingConfiguration(copied, sourceEndpoint, destinationEndpoint);
|
|
1714
1715
|
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);
|
|
@@ -5710,9 +5711,10 @@ class ManagedScenarioTrackingRuntime {
|
|
|
5710
5711
|
this.timeoutLoop = null;
|
|
5711
5712
|
const sourceSpec = asTrackingRecord(pickTrackingValue(tracking, "Source", "source"));
|
|
5712
5713
|
const destinationSpec = asTrackingRecord(pickTrackingValue(tracking, "Destination", "destination"));
|
|
5713
|
-
|
|
5714
|
+
const useLoadStrikeTraceIdHeader = readUseLoadStrikeTraceIdHeader(tracking);
|
|
5715
|
+
this.sourceEndpoint = mapRuntimeTrackingEndpointSpec(sourceSpec, useLoadStrikeTraceIdHeader);
|
|
5714
5716
|
this.destinationEndpoint = Object.keys(destinationSpec).length
|
|
5715
|
-
? mapRuntimeTrackingEndpointSpec(destinationSpec)
|
|
5717
|
+
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
5716
5718
|
: null;
|
|
5717
5719
|
validateRuntimeTrackingConfiguration(tracking, this.sourceEndpoint, this.destinationEndpoint);
|
|
5718
5720
|
this.runMode = normalizeTrackingRunMode(pickTrackingString(tracking, "RunMode", "runMode", "GenerateAndCorrelate"));
|
|
@@ -6207,9 +6209,12 @@ function getScenarioTrackingRuntime(context, tracking) {
|
|
|
6207
6209
|
return lease.runtime;
|
|
6208
6210
|
}
|
|
6209
6211
|
function buildTrackingLeaseKey(sessionId, scenarioName, tracking) {
|
|
6210
|
-
const
|
|
6212
|
+
const useLoadStrikeTraceIdHeader = readUseLoadStrikeTraceIdHeader(tracking);
|
|
6213
|
+
const source = mapRuntimeTrackingEndpointSpec(asTrackingRecord(pickTrackingValue(tracking, "Source", "source")), useLoadStrikeTraceIdHeader);
|
|
6211
6214
|
const destinationSpec = asTrackingRecord(pickTrackingValue(tracking, "Destination", "destination"));
|
|
6212
|
-
const destination = Object.keys(destinationSpec).length
|
|
6215
|
+
const destination = Object.keys(destinationSpec).length
|
|
6216
|
+
? mapRuntimeTrackingEndpointSpec(destinationSpec, useLoadStrikeTraceIdHeader)
|
|
6217
|
+
: null;
|
|
6213
6218
|
const runMode = normalizeTrackingRunMode(pickTrackingString(tracking, "RunMode", "runMode", "GenerateAndCorrelate"));
|
|
6214
6219
|
return `${sessionId}|${scenarioName}|${source.name}|${destination?.name ?? "<source-only>"}|${runMode}`;
|
|
6215
6220
|
}
|
|
@@ -6289,6 +6294,9 @@ function validateRuntimeTrackingConfiguration(tracking, sourceEndpoint, destinat
|
|
|
6289
6294
|
}
|
|
6290
6295
|
throw new RangeError(`Unsupported tracking run mode: ${runMode}.`);
|
|
6291
6296
|
}
|
|
6297
|
+
function readUseLoadStrikeTraceIdHeader(tracking) {
|
|
6298
|
+
return pickTrackingBoolean(tracking, "UseLoadStrikeTraceIdHeader", "useLoadStrikeTraceIdHeader", false);
|
|
6299
|
+
}
|
|
6292
6300
|
function validateRuntimeRedisCorrelationStoreConfiguration(tracking) {
|
|
6293
6301
|
const storeSpec = asTrackingRecord(pickTrackingValue(tracking, "CorrelationStore", "correlationStore"));
|
|
6294
6302
|
const kind = pickTrackingString(storeSpec, "Kind", "kind", "").trim().toLowerCase();
|
|
@@ -6372,12 +6380,12 @@ function sanitizeTrackingNamespacePart(value) {
|
|
|
6372
6380
|
.replace(/\s+/g, "_");
|
|
6373
6381
|
}
|
|
6374
6382
|
async function produceOrConsumeTrackingPayload(adapter, endpoint, runMode, index) {
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
return normalizeRuntimeTrackingPayload(
|
|
6383
|
+
if (runMode === "correlateexistingtraffic") {
|
|
6384
|
+
return normalizeRuntimeObservedTrackingPayload(await adapter.consume(), endpoint);
|
|
6385
|
+
}
|
|
6386
|
+
return normalizeRuntimeTrackingPayload(await adapter.produce(), endpoint, index);
|
|
6379
6387
|
}
|
|
6380
|
-
function mapRuntimeTrackingEndpointSpec(spec) {
|
|
6388
|
+
function mapRuntimeTrackingEndpointSpec(spec, useLoadStrikeTraceIdHeader = false) {
|
|
6381
6389
|
const pollIntervalMs = Math.trunc(pickTrackingNumber(spec, ["PollIntervalMs", "pollIntervalMs"], pickTrackingNumber(spec, ["PollIntervalSeconds", "pollIntervalSeconds", "PollInterval"], 0.25) * 1000));
|
|
6382
6390
|
const httpSpec = asTrackingRecord(pickTrackingValue(spec, "Http", "http"));
|
|
6383
6391
|
const delegateSpec = asTrackingRecord(pickTrackingValue(spec, "delegate", "Delegate", "DelegateStream"));
|
|
@@ -6404,7 +6412,7 @@ function mapRuntimeTrackingEndpointSpec(spec) {
|
|
|
6404
6412
|
kind: pickTrackingString(spec, "Kind", "kind", "DelegateStream"),
|
|
6405
6413
|
mode: pickTrackingString(spec, "Mode", "mode", "Produce"),
|
|
6406
6414
|
name: pickTrackingString(spec, "Name", "name", "endpoint"),
|
|
6407
|
-
trackingField: pickTrackingSelectorString(spec, "TrackingField", "trackingField", "header:x-correlation-id"),
|
|
6415
|
+
trackingField: pickTrackingSelectorString(spec, "TrackingField", "trackingField", useLoadStrikeTraceIdHeader ? LOADSTRIKE_TRACE_ID_TRACKING_FIELD : "header:x-correlation-id"),
|
|
6408
6416
|
gatherByField: pickOptionalTrackingSelectorString(spec, "GatherByField", "gatherByField"),
|
|
6409
6417
|
autoGenerateTrackingIdWhenMissing: pickTrackingBoolean(spec, "AutoGenerateTrackingIdWhenMissing", "autoGenerateTrackingIdWhenMissing", true),
|
|
6410
6418
|
pollIntervalMs,
|
|
@@ -6510,7 +6518,9 @@ function normalizeRuntimeTrackingPayload(payload, endpoint, index) {
|
|
|
6510
6518
|
if (existing || !endpoint.autoGenerateTrackingIdWhenMissing) {
|
|
6511
6519
|
return normalized;
|
|
6512
6520
|
}
|
|
6513
|
-
const generated =
|
|
6521
|
+
const generated = endpoint.trackingField.trim().toLowerCase() === LOADSTRIKE_TRACE_ID_TRACKING_FIELD
|
|
6522
|
+
? randomUUID()
|
|
6523
|
+
: `${endpoint.name}-auto-${index + 1}`;
|
|
6514
6524
|
const selector = endpoint.trackingField.trim();
|
|
6515
6525
|
if (selector.toLowerCase().startsWith("header:")) {
|
|
6516
6526
|
const headerName = selector.slice("header:".length).trim();
|
package/dist/esm/transports.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { TrackingFieldSelector } from "./correlation.js";
|
|
3
|
+
export const LOADSTRIKE_TRACE_ID_HEADER = "loadstrike-trace-id";
|
|
4
|
+
export const LOADSTRIKE_TRACE_ID_TRACKING_FIELD = `header:${LOADSTRIKE_TRACE_ID_HEADER}`;
|
|
3
5
|
class TrafficEndpointDefinitionModel {
|
|
4
6
|
get JsonSerializerSettings() {
|
|
5
7
|
return this.JsonSettings;
|
|
@@ -1048,8 +1050,9 @@ class HttpEndpointAdapter extends CallbackAdapter {
|
|
|
1048
1050
|
if (this.endpoint.mode !== "Produce") {
|
|
1049
1051
|
return null;
|
|
1050
1052
|
}
|
|
1051
|
-
const resolved = payload ?? this.defaultPayload();
|
|
1052
1053
|
const httpOptions = this.endpoint.http;
|
|
1054
|
+
const responseTracking = canonicalizeHttpTrackingPayloadSource(String(httpOptions?.trackingPayloadSource ?? "Request")) === "Response";
|
|
1055
|
+
const resolved = prepareProducedPayload(this.endpoint, payload, !responseTracking);
|
|
1053
1056
|
if (!httpOptions?.url) {
|
|
1054
1057
|
return super.produce(resolved);
|
|
1055
1058
|
}
|
|
@@ -2951,7 +2954,7 @@ function createDefaultPayload(endpoint) {
|
|
|
2951
2954
|
jsonConvertSettings: endpoint.jsonConvertSettings ? { ...endpoint.jsonConvertSettings } : undefined
|
|
2952
2955
|
});
|
|
2953
2956
|
}
|
|
2954
|
-
function prepareProducedPayload(endpoint, payload) {
|
|
2957
|
+
function prepareProducedPayload(endpoint, payload, allowAutoGenerateTrackingId = true) {
|
|
2955
2958
|
const base = payload
|
|
2956
2959
|
? attachPayloadHelpers({
|
|
2957
2960
|
headers: {
|
|
@@ -2970,15 +2973,24 @@ function prepareProducedPayload(endpoint, payload) {
|
|
|
2970
2973
|
if (trackingId) {
|
|
2971
2974
|
return base;
|
|
2972
2975
|
}
|
|
2976
|
+
if (!allowAutoGenerateTrackingId) {
|
|
2977
|
+
return base;
|
|
2978
|
+
}
|
|
2973
2979
|
if (endpoint.autoGenerateTrackingIdWhenMissing === false) {
|
|
2974
2980
|
throw new Error(`Tracking id could not be extracted using selector \`${endpoint.trackingField}\` and AutoGenerateTrackingIdWhenMissing is disabled for endpoint \`${endpoint.name}\`.`);
|
|
2975
2981
|
}
|
|
2976
|
-
const generated =
|
|
2982
|
+
const generated = isLoadStrikeTraceSelector(endpoint.trackingField)
|
|
2983
|
+
? randomUUID()
|
|
2984
|
+
: randomUUID().replace(/-/g, "");
|
|
2977
2985
|
if (!injectTrackingValue(base, endpoint.trackingField, generated)) {
|
|
2978
2986
|
throw new Error(`Tracking id could not be injected using selector \`${endpoint.trackingField}\` for endpoint \`${endpoint.name}\`. Verify the selector and payload shape.`);
|
|
2979
2987
|
}
|
|
2980
2988
|
return base;
|
|
2981
2989
|
}
|
|
2990
|
+
function isLoadStrikeTraceSelector(selector) {
|
|
2991
|
+
const trimmed = selector.trim();
|
|
2992
|
+
return trimmed.toLowerCase() === LOADSTRIKE_TRACE_ID_TRACKING_FIELD;
|
|
2993
|
+
}
|
|
2982
2994
|
function toWirePayload(payload, endpoint) {
|
|
2983
2995
|
return {
|
|
2984
2996
|
headers: { ...(payload.headers ?? {}) },
|
|
@@ -76,6 +76,7 @@ export interface LoadStrikeTrackingConfigurationSpec {
|
|
|
76
76
|
TrackingFieldValueCaseSensitive?: boolean;
|
|
77
77
|
GatherByFieldValueCaseSensitive?: boolean;
|
|
78
78
|
ExecuteOriginalScenarioRun?: boolean;
|
|
79
|
+
UseLoadStrikeTraceIdHeader?: boolean;
|
|
79
80
|
MetricPrefix?: string;
|
|
80
81
|
CorrelationStore?: LoadStrikeCorrelationStoreSpec;
|
|
81
82
|
}
|
|
@@ -93,7 +94,7 @@ export interface LoadStrikeEndpointSpec {
|
|
|
93
94
|
Kind: string;
|
|
94
95
|
Name: string;
|
|
95
96
|
Mode: string;
|
|
96
|
-
TrackingField
|
|
97
|
+
TrackingField?: string;
|
|
97
98
|
GatherByField?: string;
|
|
98
99
|
AutoGenerateTrackingIdWhenMissing?: boolean;
|
|
99
100
|
PollIntervalSeconds?: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { CrossPlatformScenarioConfigurator, ScenarioTrackingExtensions, LoadStri
|
|
|
6
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, CrossPlatformTrackingConfiguration, 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
|
-
export { EndpointAdapterFactory, TrafficEndpointDefinition, HttpEndpointDefinition, KafkaEndpointDefinition, KafkaSaslOptions, RabbitMqEndpointDefinition, NatsEndpointDefinition, RedisStreamsEndpointDefinition, AzureEventHubsEndpointDefinition, DelegateStreamEndpointDefinition, PushDiffusionEndpointDefinition, HttpOAuth2ClientCredentialsOptions, HttpAuthOptions } from "./transports.js";
|
|
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";
|
|
10
10
|
export type { EndpointAdapter, EndpointDefinition, EndpointDefinitionInput, EndpointKind, EndpointMode, DotNetDelegateEndpointOptions, DotNetEndpointDefinition, DotNetHttpAuthOptions, DotNetHttpEndpointOptions, DotNetHttpOAuth2ClientCredentialsOptions, HttpAuthMode, HttpAuthType, HttpRequestBodyType, HttpResponseSource, HttpTrackingPayloadSource, KafkaSaslMechanismType, KafkaSecurityProtocolType, HttpEndpointOptions, KafkaEndpointOptions, RabbitMqEndpointOptions, NatsEndpointOptions, RedisStreamsEndpointOptions, AzureEventHubsEndpointOptions, PushDiffusionEndpointOptions, TrackingFieldSelectorInput, TrackingRunMode, TrafficEndpointKind, TrafficEndpointMode, ProducedMessageRequest, ProducedMessageResult, ConsumedMessage, DelegateConsumeAsync, DelegateConsumeStreamHandler, DelegateEndpointOptions } from "./transports.js";
|
|
11
11
|
export { DatadogReportingSink, DatadogReportingSinkOptions, GrafanaLokiReportingSink, GrafanaLokiReportingSinkOptions, InfluxDbReportingSink, InfluxDbReportingSinkOptions, OtelCollectorReportingSink, OtelCollectorReportingSinkOptions, SplunkReportingSink, SplunkReportingSinkOptions, TimescaleDbReportingSink, TimescaleDbReportingSinkOptions } from "./sinks.js";
|
|
12
12
|
export type { DatadogSinkOptions, GrafanaLokiSinkOptions, InfluxDbSinkOptions, OtelCollectorSinkOptions, SplunkSinkOptions, TimescaleDbSinkOptions } from "./sinks.js";
|
package/dist/types/local.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ declare function evaluateScenarioOutcome(scenario: Record<string, unknown>, requ
|
|
|
67
67
|
}>;
|
|
68
68
|
declare function validateTrackingConfiguration(tracking: Record<string, unknown>, sourceEndpoint: EndpointDefinition, destinationEndpoint: EndpointDefinition | null): void;
|
|
69
69
|
declare function inferLegacyHttpResponseSourceValue(value: string | undefined): "ResponseBody" | "ResponseHeaders" | "ResponseStatusCode" | undefined;
|
|
70
|
-
declare function mapEndpointSpec(spec: Record<string, unknown
|
|
70
|
+
declare function mapEndpointSpec(spec: Record<string, unknown>, useLoadStrikeTraceIdHeader?: boolean): EndpointDefinition;
|
|
71
71
|
declare function normalizePayload(payload: TrackingPayload | null, endpoint: EndpointDefinition, index: number): TrackingPayload;
|
|
72
72
|
declare function readTrackingId(payload: TrackingPayload, selector: string): string | null;
|
|
73
73
|
declare function readOptionalTrackingSelectorValue(value: unknown): string | undefined;
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -2103,7 +2103,7 @@ declare function readRuntimeRedisCorrelationStoreOptions(redisSpec: Record<strin
|
|
|
2103
2103
|
declare function buildTrackingRunNamespace(sessionId: string, scenarioName: string, sourceName: string, destinationName?: string | null): string;
|
|
2104
2104
|
declare function sanitizeTrackingNamespacePart(value: string): string;
|
|
2105
2105
|
declare function produceOrConsumeTrackingPayload(adapter: EndpointAdapter, endpoint: EndpointDefinition, runMode: string, index: number): Promise<TrackingPayload | null>;
|
|
2106
|
-
declare function mapRuntimeTrackingEndpointSpec(spec: Record<string, unknown
|
|
2106
|
+
declare function mapRuntimeTrackingEndpointSpec(spec: Record<string, unknown>, useLoadStrikeTraceIdHeader?: boolean): EndpointDefinition;
|
|
2107
2107
|
declare function normalizeRuntimeTrackingPayload(payload: TrackingPayload | null, endpoint: EndpointDefinition, index: number): TrackingPayload;
|
|
2108
2108
|
declare function readRuntimeTrackingId(payload: TrackingPayload, selector: string): string | null;
|
|
2109
2109
|
declare function runtimeParseBodyAsObject(body: unknown): Record<string, unknown> | null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { TrackingFieldSelector, type TrackingPayload } from "./correlation.js";
|
|
2
|
+
export declare const LOADSTRIKE_TRACE_ID_HEADER = "loadstrike-trace-id";
|
|
3
|
+
export declare const LOADSTRIKE_TRACE_ID_TRACKING_FIELD = "header:loadstrike-trace-id";
|
|
2
4
|
export type EndpointKind = "Http" | "Kafka" | "RabbitMq" | "Nats" | "RedisStreams" | "AzureEventHubs" | "PushDiffusion" | "DelegateStream";
|
|
3
5
|
export type EndpointMode = "Produce" | "Consume";
|
|
4
6
|
export type HttpAuthMode = "None" | "Basic" | "Bearer" | "OAuth2ClientCredentials";
|
|
@@ -804,7 +806,7 @@ declare function attachPayloadHelpers(payload: TrackingPayload): TrackingPayload
|
|
|
804
806
|
declare function attachDotNetTrackingPayloadAliases<T extends TrackingPayload>(payload: T): T;
|
|
805
807
|
declare function attachStructuredProducedMessageRequestAliases(request: ProducedMessageRequest, endpoint: EndpointDefinition): ProducedMessageRequest;
|
|
806
808
|
declare function createDelegateRequestEndpointView(endpoint: EndpointDefinition): Record<string, unknown>;
|
|
807
|
-
declare function prepareProducedPayload(endpoint: EndpointDefinition, payload?: TrackingPayload): TrackingPayload;
|
|
809
|
+
declare function prepareProducedPayload(endpoint: EndpointDefinition, payload?: TrackingPayload, allowAutoGenerateTrackingId?: boolean): TrackingPayload;
|
|
808
810
|
declare function serializePayloadBody(body: unknown, contentType?: string): Uint8Array;
|
|
809
811
|
declare function deserializeBrokerPayloadBody(body: Uint8Array, contentType?: string, messagePayloadType?: string): unknown;
|
|
810
812
|
declare function extractTrackingValue(payload: TrackingPayload, selector: string): string | null;
|
package/package.json
CHANGED