brass-runtime 1.15.0 → 1.16.1
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/CHANGELOG.md +17 -0
- package/README.md +673 -136
- package/dist/agent/cli/main.cjs +40 -35
- package/dist/agent/cli/main.js +9 -4
- package/dist/agent/cli/main.mjs +9 -4
- package/dist/agent/index.cjs +8 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +7 -3
- package/dist/agent/index.mjs +7 -3
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/chunk-3AYM6WPJ.js +1629 -0
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-VEZNF5GZ.cjs → chunk-4ROBZFL6.cjs} +130 -126
- package/dist/{chunk-3QMOKAS5.js → chunk-52OB2ROS.js} +9 -5
- package/dist/chunk-52PPNNI4.cjs +416 -0
- package/dist/chunk-5EC274J5.cjs +2874 -0
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/chunk-5VRJNBLZ.mjs +2874 -0
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-76YMRMH2.cjs +777 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-4NHES7VK.mjs → chunk-7JIJOVCT.js} +27 -13
- package/dist/chunk-A2OM6NEH.mjs +194 -0
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-AVNQLJ5V.js +777 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-ELOOF35R.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/chunk-BABBZK4Y.js +2024 -0
- package/dist/chunk-C3MDXTRZ.js +354 -0
- package/dist/chunk-CIZFIMK5.js +2193 -0
- package/dist/chunk-CZIVE6NT.cjs +354 -0
- package/dist/chunk-DNFJLJMW.mjs +354 -0
- package/dist/chunk-DNFO2EIZ.mjs +777 -0
- package/dist/chunk-EJ6BPYVR.mjs +416 -0
- package/dist/chunk-ENKODRU3.cjs +2193 -0
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/{chunk-BMH5AV44.js → chunk-FH2X7BVP.js} +756 -440
- package/dist/{chunk-PPUXIH5R.js → chunk-FHQGHPMO.mjs} +27 -13
- package/dist/{chunk-TGIFUAK4.cjs → chunk-GLE2WY7Z.cjs} +951 -635
- package/dist/{chunk-BDF4AMWX.mjs → chunk-GYM3LLGS.mjs} +756 -440
- package/dist/chunk-HLWLMW2F.mjs +2024 -0
- package/dist/chunk-JF5WGYJJ.cjs +194 -0
- package/dist/chunk-KH4SYAOS.mjs +1629 -0
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-STVLQ3XD.cjs → chunk-KZJQ723N.cjs} +92 -78
- package/dist/chunk-L2SYFEBS.js +194 -0
- package/dist/chunk-L6VB5N7Q.cjs +104 -0
- package/dist/{chunk-K6M7MDZ4.mjs → chunk-MBEJI5HF.mjs} +9 -5
- package/dist/chunk-MIIYDLGM.js +2874 -0
- package/dist/chunk-MOO4L7F4.mjs +104 -0
- package/dist/chunk-MT3OWDPC.mjs +2193 -0
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/chunk-Q2I37RP3.cjs +1629 -0
- package/dist/chunk-RKGKFN2A.js +416 -0
- package/dist/{chunk-R3R2FVLG.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/chunk-TRM4JUZQ.js +104 -0
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-TO7IKXYT.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VN44DYYT.cjs +2024 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/client-CZHU674n.d.ts +820 -0
- package/dist/core/index.cjs +198 -4
- package/dist/core/index.d.ts +311 -212
- package/dist/core/index.js +237 -43
- package/dist/core/index.mjs +237 -43
- package/dist/{effect-CMOQKX8y.d.ts → effect-DIUHZ9IN.d.ts} +195 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/effectRunner-L4S7IPT3.js +8 -0
- package/dist/effectRunner-NNGG75QA.mjs +8 -0
- package/dist/http/index.cjs +1227 -2971
- package/dist/http/index.d.ts +826 -280
- package/dist/http/index.js +1089 -2833
- package/dist/http/index.mjs +1089 -2833
- package/dist/http/testing.cjs +161 -0
- package/dist/http/testing.d.ts +43 -0
- package/dist/http/testing.js +161 -0
- package/dist/http/testing.mjs +161 -0
- package/dist/index.cjs +486 -250
- package/dist/index.d.ts +87 -95
- package/dist/index.js +391 -155
- package/dist/index.mjs +391 -155
- package/dist/observability/index.cjs +162 -0
- package/dist/observability/index.d.ts +152 -0
- package/dist/observability/index.js +162 -0
- package/dist/observability/index.mjs +162 -0
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +29 -0
- package/dist/schema/index.d.ts +179 -0
- package/dist/schema/index.js +29 -0
- package/dist/schema/index.mjs +29 -0
- package/dist/server-GJPg8ZSG.d.ts +675 -0
- package/dist/{stream-FQm9h4Mg.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/tracer-Hwt1cl7h.d.ts +189 -0
- package/dist/tracing-DqbTKGcf.d.ts +148 -0
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +63 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +336 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +98 -0
- package/docs/observability.md +542 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +48 -2
- package/dist/chunk-AR22SXML.js +0 -1043
- package/dist/chunk-BDYEENHT.js +0 -224
- package/dist/chunk-JFPU5GQI.mjs +0 -1043
- package/dist/chunk-MS34J5LY.cjs +0 -224
- package/dist/chunk-UMAZLXAB.mjs +0 -224
- package/dist/chunk-XPZNXSVN.cjs +0 -1043
- package/dist/tracing-DNT9jEbr.d.ts +0 -106
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
type PerfTagValue = string | number | boolean;
|
|
2
|
+
type PerfEventType = "mark" | "measure" | "counter" | "gauge";
|
|
3
|
+
type PerfEvent = {
|
|
4
|
+
readonly type: PerfEventType;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly timestamp: number;
|
|
7
|
+
readonly durationMs?: number;
|
|
8
|
+
readonly value?: number;
|
|
9
|
+
readonly unit?: string;
|
|
10
|
+
readonly tags?: Readonly<Record<string, PerfTagValue>>;
|
|
11
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
type PerfRecorderOptions = {
|
|
14
|
+
readonly maxEvents?: number;
|
|
15
|
+
readonly clock?: () => number;
|
|
16
|
+
};
|
|
17
|
+
type PerfRecorderStats = {
|
|
18
|
+
readonly capacity: number;
|
|
19
|
+
readonly size: number;
|
|
20
|
+
readonly recorded: number;
|
|
21
|
+
readonly dropped: number;
|
|
22
|
+
};
|
|
23
|
+
type PerfEventSummary = {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly type: PerfEventType;
|
|
26
|
+
readonly count: number;
|
|
27
|
+
readonly totalDurationMs: number;
|
|
28
|
+
readonly maxDurationMs: number;
|
|
29
|
+
readonly lastTimestamp: number;
|
|
30
|
+
readonly lastValue?: number;
|
|
31
|
+
readonly unit?: string;
|
|
32
|
+
};
|
|
33
|
+
type PerfRecorder = {
|
|
34
|
+
readonly record: (event: Omit<PerfEvent, "timestamp"> & {
|
|
35
|
+
readonly timestamp?: number;
|
|
36
|
+
}) => PerfEvent;
|
|
37
|
+
readonly mark: (name: string, details?: Readonly<Record<string, unknown>>, tags?: Readonly<Record<string, PerfTagValue>>) => PerfEvent;
|
|
38
|
+
readonly measure: <A>(name: string, fn: () => A, details?: Readonly<Record<string, unknown>>, tags?: Readonly<Record<string, PerfTagValue>>) => A;
|
|
39
|
+
readonly measureAsync: <A>(name: string, fn: () => Promise<A>, details?: Readonly<Record<string, unknown>>, tags?: Readonly<Record<string, PerfTagValue>>) => Promise<A>;
|
|
40
|
+
readonly counter: (name: string, value?: number, unit?: string, tags?: Readonly<Record<string, PerfTagValue>>) => PerfEvent;
|
|
41
|
+
readonly gauge: (name: string, value: number, unit?: string, tags?: Readonly<Record<string, PerfTagValue>>) => PerfEvent;
|
|
42
|
+
readonly snapshot: () => readonly PerfEvent[];
|
|
43
|
+
readonly stats: () => PerfRecorderStats;
|
|
44
|
+
readonly explain: () => readonly PerfEventSummary[];
|
|
45
|
+
readonly clear: () => void;
|
|
46
|
+
};
|
|
47
|
+
declare function makePerfRecorder(options?: PerfRecorderOptions): PerfRecorder;
|
|
48
|
+
declare function summarizePerfEvents(events: readonly PerfEvent[]): readonly PerfEventSummary[];
|
|
49
|
+
|
|
50
|
+
type PerfMemorySnapshot = {
|
|
51
|
+
readonly timestamp: number;
|
|
52
|
+
readonly heapUsedMb: number;
|
|
53
|
+
readonly heapTotalMb: number;
|
|
54
|
+
readonly rssMb: number;
|
|
55
|
+
readonly externalMb: number;
|
|
56
|
+
readonly arrayBuffersMb: number;
|
|
57
|
+
readonly gcAvailable: boolean;
|
|
58
|
+
};
|
|
59
|
+
type PerfMemoryDelta = {
|
|
60
|
+
readonly heapUsedMb: number;
|
|
61
|
+
readonly heapTotalMb: number;
|
|
62
|
+
readonly rssMb: number;
|
|
63
|
+
readonly externalMb: number;
|
|
64
|
+
readonly arrayBuffersMb: number;
|
|
65
|
+
};
|
|
66
|
+
type PerfMemorySnapshotOptions = {
|
|
67
|
+
readonly forceGc?: boolean;
|
|
68
|
+
readonly gcPasses?: number;
|
|
69
|
+
readonly clock?: () => number;
|
|
70
|
+
};
|
|
71
|
+
type MemoryRetentionReport = {
|
|
72
|
+
readonly label: string;
|
|
73
|
+
readonly durationMs: number;
|
|
74
|
+
readonly before: PerfMemorySnapshot;
|
|
75
|
+
readonly after: PerfMemorySnapshot;
|
|
76
|
+
readonly delta: PerfMemoryDelta;
|
|
77
|
+
};
|
|
78
|
+
type MemoryRetentionOptions = PerfMemorySnapshotOptions & {
|
|
79
|
+
readonly label?: string;
|
|
80
|
+
};
|
|
81
|
+
type MemoryRetentionResult<A> = {
|
|
82
|
+
readonly value: A;
|
|
83
|
+
readonly report: MemoryRetentionReport;
|
|
84
|
+
};
|
|
85
|
+
declare function hasGc(): boolean;
|
|
86
|
+
declare function forceGc(passes?: number): boolean;
|
|
87
|
+
declare function captureMemorySnapshot(options?: PerfMemorySnapshotOptions): PerfMemorySnapshot;
|
|
88
|
+
declare function diffMemorySnapshots(before: PerfMemorySnapshot, after: PerfMemorySnapshot): PerfMemoryDelta;
|
|
89
|
+
declare function profileMemoryRetention<A>(fn: () => A | Promise<A>, options?: MemoryRetentionOptions): Promise<MemoryRetentionResult<A>>;
|
|
90
|
+
|
|
91
|
+
type RuntimeProfileVariant = "default" | "fiber-only" | "active-hooks" | "recorder" | "wide-scheduler";
|
|
92
|
+
type RuntimePrimitiveProfile = {
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly units: number;
|
|
95
|
+
readonly unit: "effect" | "operation";
|
|
96
|
+
readonly durationMs: number;
|
|
97
|
+
readonly nsPerOperation: number;
|
|
98
|
+
readonly operationsPerSecond: number;
|
|
99
|
+
readonly fibersStarted: number;
|
|
100
|
+
readonly fibersPerThousandOps: number;
|
|
101
|
+
};
|
|
102
|
+
type RuntimePrimitiveProfileReport = {
|
|
103
|
+
readonly variant: RuntimeProfileVariant;
|
|
104
|
+
readonly label: string;
|
|
105
|
+
readonly iterations: number;
|
|
106
|
+
readonly chainDepth: number;
|
|
107
|
+
readonly hooksActive: boolean;
|
|
108
|
+
readonly recorderEvents?: number;
|
|
109
|
+
readonly scheduler: {
|
|
110
|
+
readonly laneMode: "single" | "fair";
|
|
111
|
+
readonly initialCapacity: number;
|
|
112
|
+
readonly maxCapacity: number;
|
|
113
|
+
readonly flushBudget: number;
|
|
114
|
+
};
|
|
115
|
+
readonly results: readonly RuntimePrimitiveProfile[];
|
|
116
|
+
};
|
|
117
|
+
type RuntimePrimitiveProfileOptions = {
|
|
118
|
+
readonly iterations?: number;
|
|
119
|
+
readonly chainDepth?: number;
|
|
120
|
+
readonly variant?: RuntimeProfileVariant;
|
|
121
|
+
readonly recorder?: PerfRecorder;
|
|
122
|
+
};
|
|
123
|
+
declare function profileRuntimePrimitives(options?: RuntimePrimitiveProfileOptions): Promise<RuntimePrimitiveProfileReport>;
|
|
124
|
+
|
|
125
|
+
type RuntimePrimitiveDiagnostic = {
|
|
126
|
+
readonly name: string;
|
|
127
|
+
readonly operationsPerSecond: number;
|
|
128
|
+
readonly nsPerOperation: number;
|
|
129
|
+
readonly fibersStarted: number;
|
|
130
|
+
readonly fibersPerThousandOps: number;
|
|
131
|
+
};
|
|
132
|
+
type RuntimeDiagnosticsReport = {
|
|
133
|
+
readonly variant: string;
|
|
134
|
+
readonly slowest: RuntimePrimitiveDiagnostic;
|
|
135
|
+
readonly fastest: RuntimePrimitiveDiagnostic;
|
|
136
|
+
readonly hotPrimitives: readonly RuntimePrimitiveDiagnostic[];
|
|
137
|
+
readonly totalFibersStarted: number;
|
|
138
|
+
readonly totalMeasuredUnits: number;
|
|
139
|
+
readonly averageFibersPerThousandOps: number;
|
|
140
|
+
readonly hooksActive: boolean;
|
|
141
|
+
readonly recorderEvents?: number;
|
|
142
|
+
readonly notes: readonly string[];
|
|
143
|
+
};
|
|
144
|
+
declare function diagnoseRuntimeProfile(report: RuntimePrimitiveProfileReport): RuntimeDiagnosticsReport;
|
|
145
|
+
|
|
146
|
+
type RuntimeAbThresholds = {
|
|
147
|
+
readonly maxRegressionPercent?: number;
|
|
148
|
+
readonly minSignificantDeltaPercent?: number;
|
|
149
|
+
};
|
|
150
|
+
type RuntimeAbOptions = {
|
|
151
|
+
readonly baseline?: RuntimeProfileVariant;
|
|
152
|
+
readonly candidate?: RuntimeProfileVariant;
|
|
153
|
+
readonly runtime?: RuntimePrimitiveProfileOptions;
|
|
154
|
+
readonly thresholds?: RuntimeAbThresholds;
|
|
155
|
+
readonly forceGc?: boolean;
|
|
156
|
+
};
|
|
157
|
+
type RuntimeAbVerdict = "improved" | "regressed" | "same";
|
|
158
|
+
type RuntimeAbComparison = {
|
|
159
|
+
readonly primitive: string;
|
|
160
|
+
readonly baselineOpsPerSecond: number;
|
|
161
|
+
readonly candidateOpsPerSecond: number;
|
|
162
|
+
readonly deltaPercent: number;
|
|
163
|
+
readonly baselineNsPerOperation: number;
|
|
164
|
+
readonly candidateNsPerOperation: number;
|
|
165
|
+
readonly fibersStartedDelta: number;
|
|
166
|
+
readonly verdict: RuntimeAbVerdict;
|
|
167
|
+
};
|
|
168
|
+
type RuntimeAbReport = {
|
|
169
|
+
readonly baselineVariant: RuntimeProfileVariant;
|
|
170
|
+
readonly candidateVariant: RuntimeProfileVariant;
|
|
171
|
+
readonly baseline: RuntimePrimitiveProfileReport;
|
|
172
|
+
readonly candidate: RuntimePrimitiveProfileReport;
|
|
173
|
+
readonly comparisons: readonly RuntimeAbComparison[];
|
|
174
|
+
readonly diagnostics: {
|
|
175
|
+
readonly baseline: RuntimeDiagnosticsReport;
|
|
176
|
+
readonly candidate: RuntimeDiagnosticsReport;
|
|
177
|
+
};
|
|
178
|
+
readonly memory: {
|
|
179
|
+
readonly delta: PerfMemoryDelta;
|
|
180
|
+
};
|
|
181
|
+
readonly passedBudget: boolean;
|
|
182
|
+
readonly budgetViolations: readonly string[];
|
|
183
|
+
};
|
|
184
|
+
declare function profileRuntimeAb(options?: RuntimeAbOptions): Promise<RuntimeAbReport>;
|
|
185
|
+
declare function compareRuntimeProfiles(baseline: RuntimePrimitiveProfileReport, candidate: RuntimePrimitiveProfileReport, thresholds?: Required<RuntimeAbThresholds>): readonly RuntimeAbComparison[];
|
|
186
|
+
declare function formatRuntimeAbReport(report: RuntimeAbReport): string;
|
|
187
|
+
|
|
188
|
+
type RuntimeSoakOptions = {
|
|
189
|
+
readonly rounds?: number;
|
|
190
|
+
readonly runtime?: RuntimePrimitiveProfileOptions;
|
|
191
|
+
readonly variant?: RuntimeProfileVariant;
|
|
192
|
+
readonly forceGc?: boolean;
|
|
193
|
+
};
|
|
194
|
+
type RuntimeSoakRound = {
|
|
195
|
+
readonly round: number;
|
|
196
|
+
readonly report: RuntimePrimitiveProfileReport;
|
|
197
|
+
readonly diagnostics: RuntimeDiagnosticsReport;
|
|
198
|
+
readonly heapDeltaMb: number;
|
|
199
|
+
readonly rssDeltaMb: number;
|
|
200
|
+
};
|
|
201
|
+
type RuntimeSoakReport = {
|
|
202
|
+
readonly variant: RuntimeProfileVariant;
|
|
203
|
+
readonly rounds: readonly RuntimeSoakRound[];
|
|
204
|
+
readonly memory: {
|
|
205
|
+
readonly delta: PerfMemoryDelta;
|
|
206
|
+
};
|
|
207
|
+
readonly throughputTrendPercent: number;
|
|
208
|
+
readonly heapTrendMb: number;
|
|
209
|
+
};
|
|
210
|
+
declare function profileRuntimeSoak(options?: RuntimeSoakOptions): Promise<RuntimeSoakReport>;
|
|
211
|
+
declare function formatRuntimeSoakReport(report: RuntimeSoakReport): string;
|
|
212
|
+
|
|
213
|
+
type RuntimePerfBudgetOptions = RuntimeAbOptions & {
|
|
214
|
+
readonly minOpsPerSecond?: number;
|
|
215
|
+
readonly maxHeapDeltaMb?: number;
|
|
216
|
+
};
|
|
217
|
+
type RuntimePerfBudgetViolation = {
|
|
218
|
+
readonly area: "regression" | "throughput" | "memory";
|
|
219
|
+
readonly message: string;
|
|
220
|
+
};
|
|
221
|
+
type RuntimePerfBudgetReport = {
|
|
222
|
+
readonly ab: RuntimeAbReport;
|
|
223
|
+
readonly passed: boolean;
|
|
224
|
+
readonly violations: readonly RuntimePerfBudgetViolation[];
|
|
225
|
+
};
|
|
226
|
+
declare function runRuntimePerfBudget(options?: RuntimePerfBudgetOptions): Promise<RuntimePerfBudgetReport>;
|
|
227
|
+
declare function formatRuntimePerfBudgetReport(report: RuntimePerfBudgetReport): string;
|
|
228
|
+
|
|
229
|
+
type HttpProfileVariant = "node-http-text" | "wire-raw" | "default-minimal-json" | "default-balanced-no-adaptive-json" | "default-balanced-json" | "default-json" | "default-json-observed";
|
|
230
|
+
type HttpLayerProfileOptions = {
|
|
231
|
+
readonly calls?: number;
|
|
232
|
+
readonly concurrency?: number;
|
|
233
|
+
readonly delayMs?: number;
|
|
234
|
+
readonly timeoutMs?: number;
|
|
235
|
+
readonly warmupCalls?: number;
|
|
236
|
+
readonly statsSampleMs?: number;
|
|
237
|
+
readonly forceGc?: boolean;
|
|
238
|
+
readonly variants?: readonly HttpProfileVariant[];
|
|
239
|
+
readonly recorder?: PerfRecorder;
|
|
240
|
+
};
|
|
241
|
+
type HttpLayerProfileResult = {
|
|
242
|
+
readonly variant: HttpProfileVariant;
|
|
243
|
+
readonly label: string;
|
|
244
|
+
readonly calls: number;
|
|
245
|
+
readonly warmupCalls: number;
|
|
246
|
+
readonly concurrency: number;
|
|
247
|
+
readonly delayMs: number;
|
|
248
|
+
readonly timeoutMs: number;
|
|
249
|
+
readonly successCount: number;
|
|
250
|
+
readonly errorCount: number;
|
|
251
|
+
readonly durationMs: number;
|
|
252
|
+
readonly warmupDurationMs: number;
|
|
253
|
+
readonly httpPerSec: number;
|
|
254
|
+
readonly requestP50Ms: number;
|
|
255
|
+
readonly requestP90Ms: number;
|
|
256
|
+
readonly requestP95Ms: number;
|
|
257
|
+
readonly requestP99Ms: number;
|
|
258
|
+
readonly serverRequests: number;
|
|
259
|
+
readonly serverMaxInFlight: number;
|
|
260
|
+
readonly clientMaxInFlight: number;
|
|
261
|
+
readonly clientWireMaxInFlight: number;
|
|
262
|
+
readonly clientPoolMaxRunning?: number;
|
|
263
|
+
readonly clientPoolMaxQueued?: number;
|
|
264
|
+
readonly lifecycleMaxQueueDepth?: number;
|
|
265
|
+
readonly lifecycleStarted?: number;
|
|
266
|
+
readonly lifecycleCompleted?: number;
|
|
267
|
+
readonly lifecycleFailed?: number;
|
|
268
|
+
readonly clientStarted?: number;
|
|
269
|
+
readonly clientSucceeded?: number;
|
|
270
|
+
readonly clientFailed?: number;
|
|
271
|
+
readonly clientTimedOut?: number;
|
|
272
|
+
readonly adaptiveMinLimit?: number;
|
|
273
|
+
readonly adaptiveMaxLimit?: number;
|
|
274
|
+
readonly adaptiveFinalLimit?: number;
|
|
275
|
+
readonly adaptiveMaxInFlight?: number;
|
|
276
|
+
readonly adaptiveMaxQueueDepth?: number;
|
|
277
|
+
readonly adaptiveFinalGradient?: number;
|
|
278
|
+
readonly adaptiveWindowSize?: number;
|
|
279
|
+
readonly observedFinishedSpans?: number;
|
|
280
|
+
readonly observedPrunedSpans?: number;
|
|
281
|
+
readonly observabilityFlushMs?: number;
|
|
282
|
+
readonly gcAvailable: boolean;
|
|
283
|
+
readonly memory: {
|
|
284
|
+
readonly before: ReturnType<typeof captureMemorySnapshot>;
|
|
285
|
+
readonly after: ReturnType<typeof captureMemorySnapshot>;
|
|
286
|
+
readonly delta: PerfMemoryDelta;
|
|
287
|
+
};
|
|
288
|
+
readonly firstError?: string;
|
|
289
|
+
};
|
|
290
|
+
type HttpLayerProfileReport = {
|
|
291
|
+
readonly calls: number;
|
|
292
|
+
readonly concurrency: number;
|
|
293
|
+
readonly delayMs: number;
|
|
294
|
+
readonly timeoutMs: number;
|
|
295
|
+
readonly warmupCalls: number;
|
|
296
|
+
readonly variants: readonly HttpProfileVariant[];
|
|
297
|
+
readonly results: readonly HttpLayerProfileResult[];
|
|
298
|
+
};
|
|
299
|
+
declare const HTTP_PROFILE_VARIANTS: readonly HttpProfileVariant[];
|
|
300
|
+
declare function profileHttpLayers(options?: HttpLayerProfileOptions): Promise<HttpLayerProfileReport>;
|
|
301
|
+
|
|
302
|
+
type HttpMemoryVerdict = "ok" | "watch" | "critical" | "unknown-gc";
|
|
303
|
+
type HttpMemoryLabOptions = Omit<HttpLayerProfileOptions, "recorder"> & {
|
|
304
|
+
readonly rounds?: number;
|
|
305
|
+
readonly heapWarnMb?: number;
|
|
306
|
+
readonly heapCriticalMb?: number;
|
|
307
|
+
readonly heapPer10kWarnMb?: number;
|
|
308
|
+
};
|
|
309
|
+
type HttpMemoryLabVariantSummary = {
|
|
310
|
+
readonly variant: HttpProfileVariant;
|
|
311
|
+
readonly label: string;
|
|
312
|
+
readonly rounds: number;
|
|
313
|
+
readonly callsPerRound: number;
|
|
314
|
+
readonly totalCalls: number;
|
|
315
|
+
readonly meanHttpPerSec: number;
|
|
316
|
+
readonly minHttpPerSec: number;
|
|
317
|
+
readonly maxHttpPerSec: number;
|
|
318
|
+
readonly maxP99Ms: number;
|
|
319
|
+
readonly totalHeapDeltaMb: number;
|
|
320
|
+
readonly maxHeapDeltaMb: number;
|
|
321
|
+
readonly heapDeltaPer10kRequestsMb: number;
|
|
322
|
+
readonly totalRssDeltaMb: number;
|
|
323
|
+
readonly maxRssDeltaMb: number;
|
|
324
|
+
readonly totalErrors: number;
|
|
325
|
+
readonly gcAvailable: boolean;
|
|
326
|
+
readonly observedFinishedSpans: number;
|
|
327
|
+
readonly adaptiveFinalLimit?: number;
|
|
328
|
+
readonly verdict: HttpMemoryVerdict;
|
|
329
|
+
readonly notes: readonly string[];
|
|
330
|
+
};
|
|
331
|
+
type HttpMemoryLabRound = {
|
|
332
|
+
readonly round: number;
|
|
333
|
+
readonly results: readonly HttpLayerProfileResult[];
|
|
334
|
+
};
|
|
335
|
+
type HttpMemoryLabReport = {
|
|
336
|
+
readonly calls: number;
|
|
337
|
+
readonly concurrency: number;
|
|
338
|
+
readonly delayMs: number;
|
|
339
|
+
readonly warmupCalls: number;
|
|
340
|
+
readonly rounds: number;
|
|
341
|
+
readonly forceGc: boolean;
|
|
342
|
+
readonly variants: readonly HttpProfileVariant[];
|
|
343
|
+
readonly summaries: readonly HttpMemoryLabVariantSummary[];
|
|
344
|
+
readonly roundsData: readonly HttpMemoryLabRound[];
|
|
345
|
+
readonly recommendations: readonly string[];
|
|
346
|
+
};
|
|
347
|
+
declare function profileHttpMemoryLab(options?: HttpMemoryLabOptions): Promise<HttpMemoryLabReport>;
|
|
348
|
+
declare function formatHttpMemoryLabReport(report: HttpMemoryLabReport): string;
|
|
349
|
+
|
|
350
|
+
type PerfHistoryProfile = "all" | "runtime" | "http" | "runtime-ab" | "runtime-soak" | "http-memory";
|
|
351
|
+
type PerfMetricDirection = "higher-is-better" | "lower-is-better" | "neutral";
|
|
352
|
+
type PerfHistoryMetric = {
|
|
353
|
+
readonly name: string;
|
|
354
|
+
readonly value: number;
|
|
355
|
+
readonly unit?: string;
|
|
356
|
+
readonly direction: PerfMetricDirection;
|
|
357
|
+
readonly tags?: Readonly<Record<string, string>>;
|
|
358
|
+
};
|
|
359
|
+
type PerfHistoryEntry = {
|
|
360
|
+
readonly id: string;
|
|
361
|
+
readonly timestamp: string;
|
|
362
|
+
readonly profile: PerfHistoryProfile;
|
|
363
|
+
readonly nodeVersion: string;
|
|
364
|
+
readonly platform: string;
|
|
365
|
+
readonly arch: string;
|
|
366
|
+
readonly metrics: readonly PerfHistoryMetric[];
|
|
367
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
368
|
+
readonly report?: unknown;
|
|
369
|
+
};
|
|
370
|
+
type PerfBaseline = {
|
|
371
|
+
readonly name: string;
|
|
372
|
+
readonly savedAt: string;
|
|
373
|
+
readonly entry: PerfHistoryEntry;
|
|
374
|
+
};
|
|
375
|
+
type PerfHistoryStoreOptions = {
|
|
376
|
+
readonly directory?: string;
|
|
377
|
+
readonly historyFileName?: string;
|
|
378
|
+
readonly baselinesDirectoryName?: string;
|
|
379
|
+
readonly maxEntries?: number;
|
|
380
|
+
readonly includeReport?: boolean;
|
|
381
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
382
|
+
};
|
|
383
|
+
type PerfBaselineThresholds = {
|
|
384
|
+
readonly maxRegressionPercent?: number;
|
|
385
|
+
readonly maxHeapRegressionPercent?: number;
|
|
386
|
+
readonly warnAtRatio?: number;
|
|
387
|
+
readonly failOnMissingMetric?: boolean;
|
|
388
|
+
};
|
|
389
|
+
type PerfBaselineComparisonStatus = "pass" | "warn" | "fail";
|
|
390
|
+
type PerfBaselineComparisonItem = {
|
|
391
|
+
readonly metric: PerfHistoryMetric;
|
|
392
|
+
readonly baselineValue: number;
|
|
393
|
+
readonly currentValue: number;
|
|
394
|
+
readonly delta: number;
|
|
395
|
+
readonly deltaPercent: number;
|
|
396
|
+
readonly status: PerfBaselineComparisonStatus;
|
|
397
|
+
readonly reason: string;
|
|
398
|
+
};
|
|
399
|
+
type PerfBaselineComparison = {
|
|
400
|
+
readonly baselineName: string;
|
|
401
|
+
readonly baselineId: string;
|
|
402
|
+
readonly currentId: string;
|
|
403
|
+
readonly comparedMetrics: number;
|
|
404
|
+
readonly missingMetrics: readonly string[];
|
|
405
|
+
readonly status: PerfBaselineComparisonStatus;
|
|
406
|
+
readonly passed: boolean;
|
|
407
|
+
readonly items: readonly PerfBaselineComparisonItem[];
|
|
408
|
+
};
|
|
409
|
+
declare function defaultPerfHistoryDirectory(cwd?: string): string;
|
|
410
|
+
declare function createPerfHistoryEntry(profile: PerfHistoryProfile, report: unknown, options?: PerfHistoryStoreOptions): PerfHistoryEntry;
|
|
411
|
+
declare function recordPerfHistoryRun(profile: PerfHistoryProfile, report: unknown, options?: PerfHistoryStoreOptions): Promise<{
|
|
412
|
+
readonly entry: PerfHistoryEntry;
|
|
413
|
+
readonly path: string;
|
|
414
|
+
}>;
|
|
415
|
+
declare function writePerfHistoryEntry(entry: PerfHistoryEntry, options?: PerfHistoryStoreOptions): Promise<string>;
|
|
416
|
+
declare function readPerfHistory(options?: PerfHistoryStoreOptions): Promise<readonly PerfHistoryEntry[]>;
|
|
417
|
+
declare function savePerfBaseline(name: string, entry: PerfHistoryEntry, options?: PerfHistoryStoreOptions): Promise<{
|
|
418
|
+
readonly baseline: PerfBaseline;
|
|
419
|
+
readonly path: string;
|
|
420
|
+
}>;
|
|
421
|
+
declare function loadPerfBaseline(name: string, options?: PerfHistoryStoreOptions): Promise<PerfBaseline | undefined>;
|
|
422
|
+
declare function comparePerfToBaseline(current: PerfHistoryEntry, baseline: PerfBaseline, thresholds?: PerfBaselineThresholds): PerfBaselineComparison;
|
|
423
|
+
declare function formatPerfBaselineComparison(comparison: PerfBaselineComparison): string;
|
|
424
|
+
declare function extractPerfMetrics(profile: PerfHistoryProfile, report: unknown): readonly PerfHistoryMetric[];
|
|
425
|
+
|
|
426
|
+
type PerfRecommendationSeverity = "info" | "warn" | "critical";
|
|
427
|
+
type PerfRecommendation = {
|
|
428
|
+
readonly severity: PerfRecommendationSeverity;
|
|
429
|
+
readonly area: "runtime" | "http" | "memory" | "observability" | "benchmark";
|
|
430
|
+
readonly title: string;
|
|
431
|
+
readonly message: string;
|
|
432
|
+
readonly evidence?: Readonly<Record<string, unknown>>;
|
|
433
|
+
readonly action?: string;
|
|
434
|
+
};
|
|
435
|
+
type PerfRecommendationThresholds = {
|
|
436
|
+
readonly maxHeapDeltaMb?: number;
|
|
437
|
+
readonly criticalHeapDeltaMb?: number;
|
|
438
|
+
readonly minDefaultVsNodeRatio?: number;
|
|
439
|
+
readonly minObservedVsDefaultRatio?: number;
|
|
440
|
+
readonly maxHttpP99Ms?: number;
|
|
441
|
+
readonly minRuntimeOpsPerSecond?: number;
|
|
442
|
+
};
|
|
443
|
+
type PerfRecommendationInput = {
|
|
444
|
+
readonly http?: HttpLayerProfileReport;
|
|
445
|
+
readonly runtime?: RuntimePrimitiveProfileReport;
|
|
446
|
+
readonly memoryDelta?: PerfMemoryDelta;
|
|
447
|
+
readonly thresholds?: PerfRecommendationThresholds;
|
|
448
|
+
};
|
|
449
|
+
declare function recommendPerformance(input: PerfRecommendationInput): readonly PerfRecommendation[];
|
|
450
|
+
|
|
451
|
+
type BrassPerformanceProfileOptions = {
|
|
452
|
+
readonly runtime?: false | RuntimePrimitiveProfileOptions;
|
|
453
|
+
readonly http?: false | HttpLayerProfileOptions;
|
|
454
|
+
readonly memory?: false | {
|
|
455
|
+
readonly forceGc?: boolean;
|
|
456
|
+
readonly gcPasses?: number;
|
|
457
|
+
};
|
|
458
|
+
readonly recorder?: PerfRecorder | PerfRecorderOptions;
|
|
459
|
+
readonly thresholds?: PerfRecommendationThresholds;
|
|
460
|
+
};
|
|
461
|
+
type BrassPerformanceReport = {
|
|
462
|
+
readonly timestamp: string;
|
|
463
|
+
readonly nodeVersion: string;
|
|
464
|
+
readonly platform: string;
|
|
465
|
+
readonly arch: string;
|
|
466
|
+
readonly runtime?: RuntimePrimitiveProfileReport;
|
|
467
|
+
readonly runtimeDiagnostics?: RuntimeDiagnosticsReport;
|
|
468
|
+
readonly http?: HttpLayerProfileReport;
|
|
469
|
+
readonly memory?: {
|
|
470
|
+
readonly before: PerfMemorySnapshot;
|
|
471
|
+
readonly after: PerfMemorySnapshot;
|
|
472
|
+
readonly delta: PerfMemoryDelta;
|
|
473
|
+
};
|
|
474
|
+
readonly recorder: {
|
|
475
|
+
readonly stats: PerfRecorderStats;
|
|
476
|
+
readonly summary: readonly PerfEventSummary[];
|
|
477
|
+
};
|
|
478
|
+
readonly recommendations: readonly PerfRecommendation[];
|
|
479
|
+
};
|
|
480
|
+
declare function runBrassPerformanceProfile(options?: BrassPerformanceProfileOptions): Promise<BrassPerformanceReport>;
|
|
481
|
+
declare function formatPerformanceReport(report: BrassPerformanceReport): string;
|
|
482
|
+
|
|
483
|
+
export { type BrassPerformanceProfileOptions, type BrassPerformanceReport, HTTP_PROFILE_VARIANTS, type HttpLayerProfileOptions, type HttpLayerProfileReport, type HttpLayerProfileResult, type HttpMemoryLabOptions, type HttpMemoryLabReport, type HttpMemoryLabRound, type HttpMemoryLabVariantSummary, type HttpMemoryVerdict, type HttpProfileVariant, type MemoryRetentionOptions, type MemoryRetentionReport, type MemoryRetentionResult, type PerfBaseline, type PerfBaselineComparison, type PerfBaselineComparisonItem, type PerfBaselineComparisonStatus, type PerfBaselineThresholds, type PerfEvent, type PerfEventSummary, type PerfEventType, type PerfHistoryEntry, type PerfHistoryMetric, type PerfHistoryProfile, type PerfHistoryStoreOptions, type PerfMemoryDelta, type PerfMemorySnapshot, type PerfMemorySnapshotOptions, type PerfMetricDirection, type PerfRecommendation, type PerfRecommendationInput, type PerfRecommendationSeverity, type PerfRecommendationThresholds, type PerfRecorder, type PerfRecorderOptions, type PerfRecorderStats, type PerfTagValue, type RuntimeAbComparison, type RuntimeAbOptions, type RuntimeAbReport, type RuntimeAbThresholds, type RuntimeAbVerdict, type RuntimeDiagnosticsReport, type RuntimePerfBudgetOptions, type RuntimePerfBudgetReport, type RuntimePerfBudgetViolation, type RuntimePrimitiveDiagnostic, type RuntimePrimitiveProfile, type RuntimePrimitiveProfileOptions, type RuntimePrimitiveProfileReport, type RuntimeProfileVariant, type RuntimeSoakOptions, type RuntimeSoakReport, type RuntimeSoakRound, captureMemorySnapshot, comparePerfToBaseline, compareRuntimeProfiles, createPerfHistoryEntry, defaultPerfHistoryDirectory, diagnoseRuntimeProfile, diffMemorySnapshots, extractPerfMetrics, forceGc, formatHttpMemoryLabReport, formatPerfBaselineComparison, formatPerformanceReport, formatRuntimeAbReport, formatRuntimePerfBudgetReport, formatRuntimeSoakReport, hasGc, loadPerfBaseline, makePerfRecorder, profileHttpLayers, profileHttpMemoryLab, profileMemoryRetention, profileRuntimeAb, profileRuntimePrimitives, profileRuntimeSoak, readPerfHistory, recommendPerformance, recordPerfHistoryRun, runBrassPerformanceProfile, runRuntimePerfBudget, savePerfBaseline, summarizePerfEvents, writePerfHistoryEntry };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HTTP_PROFILE_VARIANTS,
|
|
3
|
+
captureMemorySnapshot,
|
|
4
|
+
comparePerfToBaseline,
|
|
5
|
+
compareRuntimeProfiles,
|
|
6
|
+
createPerfHistoryEntry,
|
|
7
|
+
defaultPerfHistoryDirectory,
|
|
8
|
+
diagnoseRuntimeProfile,
|
|
9
|
+
diffMemorySnapshots,
|
|
10
|
+
extractPerfMetrics,
|
|
11
|
+
forceGc,
|
|
12
|
+
formatHttpMemoryLabReport,
|
|
13
|
+
formatPerfBaselineComparison,
|
|
14
|
+
formatPerformanceReport,
|
|
15
|
+
formatRuntimeAbReport,
|
|
16
|
+
formatRuntimeSoakReport,
|
|
17
|
+
hasGc,
|
|
18
|
+
loadPerfBaseline,
|
|
19
|
+
makePerfRecorder,
|
|
20
|
+
profileHttpLayers,
|
|
21
|
+
profileHttpMemoryLab,
|
|
22
|
+
profileMemoryRetention,
|
|
23
|
+
profileRuntimeAb,
|
|
24
|
+
profileRuntimePrimitives,
|
|
25
|
+
profileRuntimeSoak,
|
|
26
|
+
readPerfHistory,
|
|
27
|
+
recommendPerformance,
|
|
28
|
+
recordPerfHistoryRun,
|
|
29
|
+
runBrassPerformanceProfile,
|
|
30
|
+
savePerfBaseline,
|
|
31
|
+
summarizePerfEvents,
|
|
32
|
+
writePerfHistoryEntry
|
|
33
|
+
} from "../chunk-BABBZK4Y.js";
|
|
34
|
+
import "../chunk-5QC7LRZ3.js";
|
|
35
|
+
import "../chunk-74ZTY6CP.js";
|
|
36
|
+
import "../chunk-MIIYDLGM.js";
|
|
37
|
+
import "../chunk-TRM4JUZQ.js";
|
|
38
|
+
import "../chunk-7JIJOVCT.js";
|
|
39
|
+
import "../chunk-UCUBNWM2.js";
|
|
40
|
+
import "../chunk-6IXXWIUM.js";
|
|
41
|
+
import "../chunk-L2SYFEBS.js";
|
|
42
|
+
import "../chunk-AVNQLJ5V.js";
|
|
43
|
+
import "../chunk-CIZFIMK5.js";
|
|
44
|
+
import "../chunk-RKGKFN2A.js";
|
|
45
|
+
import "../chunk-3Y2RIUMM.js";
|
|
46
|
+
import "../chunk-FH2X7BVP.js";
|
|
47
|
+
import "../chunk-UB4B6OFY.js";
|
|
48
|
+
import "../chunk-C3MDXTRZ.js";
|
|
49
|
+
import "../chunk-3RG5ZIWI.js";
|
|
50
|
+
|
|
51
|
+
// src/perf/budget.ts
|
|
52
|
+
async function runRuntimePerfBudget(options = {}) {
|
|
53
|
+
const ab = await profileRuntimeAb({
|
|
54
|
+
...options,
|
|
55
|
+
thresholds: {
|
|
56
|
+
maxRegressionPercent: options.thresholds?.maxRegressionPercent ?? 50,
|
|
57
|
+
minSignificantDeltaPercent: options.thresholds?.minSignificantDeltaPercent ?? 5
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const minOpsPerSecond = positiveNumber(options.minOpsPerSecond, 1e4);
|
|
61
|
+
const maxHeapDeltaMb = positiveNumber(options.maxHeapDeltaMb, 32);
|
|
62
|
+
const violations = [];
|
|
63
|
+
for (const violation of ab.budgetViolations) {
|
|
64
|
+
violations.push({ area: "regression", message: violation });
|
|
65
|
+
}
|
|
66
|
+
for (const result of ab.candidate.results) {
|
|
67
|
+
if (result.units >= 1e3 && result.operationsPerSecond < minOpsPerSecond) {
|
|
68
|
+
violations.push({
|
|
69
|
+
area: "throughput",
|
|
70
|
+
message: `${result.name} throughput ${result.operationsPerSecond} ops/s is below ${minOpsPerSecond} ops/s`
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (ab.memory.delta.heapUsedMb > maxHeapDeltaMb) {
|
|
75
|
+
violations.push({
|
|
76
|
+
area: "memory",
|
|
77
|
+
message: `runtime A/B heap delta ${ab.memory.delta.heapUsedMb}MB exceeds ${maxHeapDeltaMb}MB`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
ab,
|
|
82
|
+
passed: violations.length === 0,
|
|
83
|
+
violations: Object.freeze(violations.map((item) => Object.freeze(item)))
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function formatRuntimePerfBudgetReport(report) {
|
|
87
|
+
const lines = [];
|
|
88
|
+
lines.push(`Runtime performance budget: ${report.passed ? "pass" : "fail"}`);
|
|
89
|
+
lines.push(`baseline=${report.ab.baselineVariant} candidate=${report.ab.candidateVariant}`);
|
|
90
|
+
for (const comparison of report.ab.comparisons) {
|
|
91
|
+
const sign = comparison.deltaPercent >= 0 ? "+" : "";
|
|
92
|
+
lines.push(`- ${comparison.primitive}: ${sign}${comparison.deltaPercent}%`);
|
|
93
|
+
}
|
|
94
|
+
if (report.violations.length > 0) {
|
|
95
|
+
lines.push("");
|
|
96
|
+
lines.push("Violations");
|
|
97
|
+
for (const violation of report.violations) {
|
|
98
|
+
lines.push(`- [${violation.area}] ${violation.message}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return lines.join("\n");
|
|
102
|
+
}
|
|
103
|
+
function positiveNumber(value, fallback) {
|
|
104
|
+
if (value === void 0 || !Number.isFinite(value)) return fallback;
|
|
105
|
+
return Math.max(0, value);
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
HTTP_PROFILE_VARIANTS,
|
|
109
|
+
captureMemorySnapshot,
|
|
110
|
+
comparePerfToBaseline,
|
|
111
|
+
compareRuntimeProfiles,
|
|
112
|
+
createPerfHistoryEntry,
|
|
113
|
+
defaultPerfHistoryDirectory,
|
|
114
|
+
diagnoseRuntimeProfile,
|
|
115
|
+
diffMemorySnapshots,
|
|
116
|
+
extractPerfMetrics,
|
|
117
|
+
forceGc,
|
|
118
|
+
formatHttpMemoryLabReport,
|
|
119
|
+
formatPerfBaselineComparison,
|
|
120
|
+
formatPerformanceReport,
|
|
121
|
+
formatRuntimeAbReport,
|
|
122
|
+
formatRuntimePerfBudgetReport,
|
|
123
|
+
formatRuntimeSoakReport,
|
|
124
|
+
hasGc,
|
|
125
|
+
loadPerfBaseline,
|
|
126
|
+
makePerfRecorder,
|
|
127
|
+
profileHttpLayers,
|
|
128
|
+
profileHttpMemoryLab,
|
|
129
|
+
profileMemoryRetention,
|
|
130
|
+
profileRuntimeAb,
|
|
131
|
+
profileRuntimePrimitives,
|
|
132
|
+
profileRuntimeSoak,
|
|
133
|
+
readPerfHistory,
|
|
134
|
+
recommendPerformance,
|
|
135
|
+
recordPerfHistoryRun,
|
|
136
|
+
runBrassPerformanceProfile,
|
|
137
|
+
runRuntimePerfBudget,
|
|
138
|
+
savePerfBaseline,
|
|
139
|
+
summarizePerfEvents,
|
|
140
|
+
writePerfHistoryEntry
|
|
141
|
+
};
|