@loadstrike/loadstrike-sdk 1.0.30001 → 1.0.30401
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/README.md +24 -0
- package/dist/cjs/cluster.js +2417 -7
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/iteration-observations.js +711 -0
- package/dist/cjs/load-engine-v2.js +966 -0
- package/dist/cjs/local.js +73 -20
- package/dist/cjs/reporting.js +123 -13
- package/dist/cjs/runtime.js +2368 -129
- package/dist/cjs/sinks.js +471 -17
- package/dist/cjs/transports.js +84 -146
- package/dist/esm/cluster.js +2386 -7
- package/dist/esm/index.js +1 -0
- package/dist/esm/iteration-observations.js +698 -0
- package/dist/esm/load-engine-v2.js +942 -0
- package/dist/esm/local.js +73 -20
- package/dist/esm/reporting.js +123 -13
- package/dist/esm/runtime.js +2369 -130
- package/dist/esm/sinks.js +471 -17
- package/dist/esm/transports.js +84 -146
- package/dist/types/cluster.d.ts +379 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/iteration-observations.d.ts +225 -0
- package/dist/types/load-engine-v2.d.ts +147 -0
- package/dist/types/runtime.d.ts +214 -8
- package/dist/types/sinks.d.ts +67 -0
- package/dist/types/transports.d.ts +2 -8
- package/package.json +3 -4
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export interface LoadEngineV2Settings {
|
|
2
|
+
contractVersion: 2;
|
|
3
|
+
maxInFlight: number;
|
|
4
|
+
clusterLoadScope: "Global";
|
|
5
|
+
statisticsReportingIntervalNs: bigint;
|
|
6
|
+
maxStatusGroupsPerSeries: number;
|
|
7
|
+
}
|
|
8
|
+
export interface LoadEngineV2TrafficMixUnit {
|
|
9
|
+
laneOrdinal: bigint;
|
|
10
|
+
globalRank: bigint;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildLoadEngineV2TrafficMixRunId(runId: string, declarationIndex: number, name: string): string;
|
|
13
|
+
export declare function buildLoadEngineV2TrafficMixSeedId(declarationIndex: number, name: string): string;
|
|
14
|
+
export declare function loadEngineV2TrafficMixRank(weights: readonly number[], laneIndex: number, laneOrdinal: bigint): bigint;
|
|
15
|
+
export declare function loadEngineV2TrafficMixLaneUnitCount(globalUnitCount: bigint, weights: readonly number[], laneIndex: number): bigint;
|
|
16
|
+
export declare function loadEngineV2TrafficMixOwnedUnits(globalUnitCount: bigint, weights: readonly number[], laneIndex: number, shardIndex: number, shardCount: number): LoadEngineV2TrafficMixUnit[];
|
|
17
|
+
export type LoadEngineV2ArrivalDecision = "wait" | "start" | "scheduler_late" | "max_in_flight";
|
|
18
|
+
export interface LoadStrikeHistogramV1Sidecar {
|
|
19
|
+
schemaVersion: "loadstrike.histogram/1";
|
|
20
|
+
mode: "exact-normalized" | "quantized-v1";
|
|
21
|
+
count64: string;
|
|
22
|
+
zeroCount64: string;
|
|
23
|
+
minimum64: string;
|
|
24
|
+
maximum64: string;
|
|
25
|
+
origin64: string;
|
|
26
|
+
meanOffsetBits: string;
|
|
27
|
+
m2Bits: string;
|
|
28
|
+
exactTotal64: string;
|
|
29
|
+
exactSamples64: string[];
|
|
30
|
+
buckets: Array<{
|
|
31
|
+
bucketKey64: string;
|
|
32
|
+
count64: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export interface LoadEngineV2DistributionRecord {
|
|
36
|
+
seriesKind: "scenario" | "step" | "scheduler-decision-lag" | "scheduler-start-lag" | "correlation";
|
|
37
|
+
scenarioIndex64: string;
|
|
38
|
+
scenarioName: string;
|
|
39
|
+
identityKeyHex: string;
|
|
40
|
+
outcome: "ok" | "fail" | "all" | "none";
|
|
41
|
+
unit: "microseconds" | "bytes" | "count";
|
|
42
|
+
histogram: LoadStrikeHistogramV1Sidecar;
|
|
43
|
+
exactTotalDecimalOrEmpty?: string;
|
|
44
|
+
bands?: Array<{
|
|
45
|
+
bandId64: string;
|
|
46
|
+
count64: string;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
export interface LoadEngineV2StatusSummaryRecord {
|
|
50
|
+
statusIdentityKeyHex: string;
|
|
51
|
+
display: string;
|
|
52
|
+
count64: string;
|
|
53
|
+
aggregatedObservationCount64: string;
|
|
54
|
+
hasAggregatedIdentities: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface LoadEngineV2MeasurementOutcomeSummary {
|
|
57
|
+
outcome: "ok" | "fail";
|
|
58
|
+
statusObservationCount64: string;
|
|
59
|
+
statuses: LoadEngineV2StatusSummaryRecord[];
|
|
60
|
+
}
|
|
61
|
+
export interface LoadEngineV2MeasurementSummary {
|
|
62
|
+
seriesKind: "scenario" | "step";
|
|
63
|
+
scenarioIndex64: string;
|
|
64
|
+
scenarioName: string;
|
|
65
|
+
identityKeyHex: string;
|
|
66
|
+
display: string;
|
|
67
|
+
observationCount64: string;
|
|
68
|
+
successCount64: string;
|
|
69
|
+
failureCount64: string;
|
|
70
|
+
aggregatedObservationCount64: string;
|
|
71
|
+
hasAggregatedIdentities: boolean;
|
|
72
|
+
outcomes: [LoadEngineV2MeasurementOutcomeSummary, LoadEngineV2MeasurementOutcomeSummary];
|
|
73
|
+
}
|
|
74
|
+
export interface LoadEngineV2HistogramArtifact {
|
|
75
|
+
distributions: LoadEngineV2DistributionRecord[];
|
|
76
|
+
measurementSummaries: LoadEngineV2MeasurementSummary[];
|
|
77
|
+
}
|
|
78
|
+
export declare class LoadEngineV2ExecutionBudget {
|
|
79
|
+
readonly maxInFlight: number;
|
|
80
|
+
private currentValue;
|
|
81
|
+
private highWaterValue;
|
|
82
|
+
constructor(maxInFlight: number);
|
|
83
|
+
get current(): number;
|
|
84
|
+
get highWater(): number;
|
|
85
|
+
tryAcquire(): (() => void) | undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Canonical bounded streaming histogram used by Load Engine V2.
|
|
89
|
+
*
|
|
90
|
+
* The first 2,048 normalized values remain exact. Larger streams are promoted
|
|
91
|
+
* into the portable quantized-v1 layout, whose 7,296 counters cover every
|
|
92
|
+
* non-negative signed 64-bit value with a maximum relative error of 1/128.
|
|
93
|
+
*/
|
|
94
|
+
export declare class LoadStrikeHistogramV1 {
|
|
95
|
+
static readonly exactLimit = 2048;
|
|
96
|
+
static readonly bucketCount = 7296;
|
|
97
|
+
private exactSamples;
|
|
98
|
+
private buckets;
|
|
99
|
+
private countValue;
|
|
100
|
+
private minimumValue;
|
|
101
|
+
private maximumValue;
|
|
102
|
+
private originValue;
|
|
103
|
+
private meanOffsetValue;
|
|
104
|
+
private m2;
|
|
105
|
+
private exactTotalValue;
|
|
106
|
+
get count(): bigint;
|
|
107
|
+
get minimum(): bigint;
|
|
108
|
+
get maximum(): bigint;
|
|
109
|
+
get origin(): bigint;
|
|
110
|
+
get meanOffset(): number;
|
|
111
|
+
get mean(): number;
|
|
112
|
+
get populationStandardDeviation(): number;
|
|
113
|
+
get mode(): "exact-normalized" | "quantized-v1";
|
|
114
|
+
get maxRelativeError(): number;
|
|
115
|
+
get retainedValueCount(): number;
|
|
116
|
+
get exactTotal(): bigint;
|
|
117
|
+
toSidecar(): LoadStrikeHistogramV1Sidecar;
|
|
118
|
+
static fromSidecar(sidecar: LoadStrikeHistogramV1Sidecar): LoadStrikeHistogramV1;
|
|
119
|
+
record(input: bigint): void;
|
|
120
|
+
clone(): LoadStrikeHistogramV1;
|
|
121
|
+
merge(other: LoadStrikeHistogramV1): void;
|
|
122
|
+
percentile(percentile: number): bigint;
|
|
123
|
+
private updateMoments;
|
|
124
|
+
private promote;
|
|
125
|
+
private addBucket;
|
|
126
|
+
private copyFrom;
|
|
127
|
+
private static bucketIndex;
|
|
128
|
+
private static bucketUpperBound;
|
|
129
|
+
private static bucketKeyFromIndex;
|
|
130
|
+
private static bucketIndexFromKey;
|
|
131
|
+
}
|
|
132
|
+
/** Serializes the canonical cumulative LoadStrikeHistogramArtifactV1 (`LS-H1`). */
|
|
133
|
+
export declare function serializeLoadEngineV2HistogramArtifact(artifact: LoadEngineV2HistogramArtifact): Buffer;
|
|
134
|
+
/** Strictly parses, validates, and canonical-byte checks an `LS-H1` artifact. */
|
|
135
|
+
export declare function parseLoadEngineV2HistogramArtifact(bytes: Uint8Array): LoadEngineV2HistogramArtifact;
|
|
136
|
+
export declare function createDefaultLoadEngineV2Settings(): LoadEngineV2Settings;
|
|
137
|
+
export declare function fnv1a32(value: string): number;
|
|
138
|
+
export declare function planFixedDeadlines(rate: number, intervalNs: bigint, durationNs: bigint): bigint[];
|
|
139
|
+
export declare function planFixedIterationDeadlines(rate: number, intervalNs: bigint, iterations: number): bigint[];
|
|
140
|
+
export declare function planRampingInjectionDeadlines(rate: number, intervalNs: bigint, durationNs: bigint): bigint[];
|
|
141
|
+
export declare function planRampingConstantDeadlines(copies: number, durationNs: bigint): bigint[];
|
|
142
|
+
export declare function planRandomInjectionDeadlines(minRate: number, maxRate: number, intervalNs: bigint, durationNs: bigint, seed: number): bigint[];
|
|
143
|
+
export declare function xorshift32(input: number): number;
|
|
144
|
+
export declare function loadEngineV2FixedDeadlineNs(ordinal: bigint, rate: number, intervalNs: bigint): bigint;
|
|
145
|
+
export declare function loadEngineV2FixedArrivalCount(rate: number, intervalNs: bigint, durationNs: bigint): bigint;
|
|
146
|
+
export declare function loadEngineV2LatenessToleranceNs(rate: number, intervalNs: bigint): bigint;
|
|
147
|
+
export declare function classifyLoadEngineV2Arrival(nowNs: bigint, deadlineNs: bigint, toleranceNs: bigint, permitAvailable: boolean): LoadEngineV2ArrivalDecision;
|