blaze-performance-tester 3.0.26 → 3.0.29

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.
Binary file
package/dist/cli.js CHANGED
@@ -74,22 +74,18 @@ try {
74
74
  process.exit(1);
75
75
  }
76
76
  var mathUtils = {
77
- //[cite: 2]
78
77
  mean: (arr) => arr.length === 0 ? 0 : arr.reduce((p, c) => p + c, 0) / arr.length,
79
- //[cite: 2]
80
78
  stdDev: (arr, mean) => {
81
79
  if (arr.length === 0) return 0;
82
80
  const r = arr.reduce((p, c) => p + Math.pow(c - mean, 2), 0);
83
81
  return Math.sqrt(r / arr.length);
84
82
  },
85
- //[cite: 2]
86
83
  percentile: (arr, p) => {
87
84
  if (arr.length === 0) return 0;
88
85
  const sorted = [...arr].sort((a, b) => a - b);
89
86
  const index = Math.ceil(p / 100 * sorted.length) - 1;
90
87
  return sorted[Math.max(0, index)];
91
88
  }
92
- //[cite: 2]
93
89
  };
94
90
  async function executeTestPipeline() {
95
91
  if (!blazeCore || typeof blazeCore.runCorrelatedTransaction !== "function") {
@@ -97,41 +93,30 @@ async function executeTestPipeline() {
97
93
  return;
98
94
  }
99
95
  const transactionalScenario = [
100
- //[cite: 1]
101
96
  {
102
- //[cite: 1]
103
97
  name: "Fetch Target Anti-Forgery Nonce",
104
- //[cite: 1]
105
98
  url: "https://httpbin.org/json",
106
- // Returns metadata configurations //[cite: 1]
99
+ // Returns metadata configurations
107
100
  method: "GET",
108
- //[cite: 1]
109
101
  body: null
110
- //[cite: 1]
111
102
  },
112
- //[cite: 1]
113
103
  {
114
- //[cite: 1]
115
104
  name: "Perform Contextual Post Action",
116
- //[cite: 1]
117
- // The engine automatically detects ${csrf_token} if returned in Step 1 and swaps it seamlessly //[cite: 1]
105
+ // The engine automatically detects ${csrf_token} if returned in Step 1 and swaps it seamlessly
118
106
  url: "https://httpbin.org/post?verification=${csrf_token}",
119
- //[cite: 1]
120
107
  method: "POST",
121
- //[cite: 1]
122
108
  body: JSON.stringify({
123
- //[cite: 1]
124
109
  data: "performance_payload",
125
- //[cite: 1]
126
110
  security_token: "${csrf_token}"
127
- //[cite: 1]
128
111
  })
129
- //[cite: 1]
130
112
  }
131
- //[cite: 1]
132
113
  ];
133
114
  console.log("Launching automated script transaction analysis...");
134
- const success = await blazeCore.runCorrelatedTransaction(transactionalScenario);
115
+ const sanitizedSteps = transactionalScenario.map((step) => ({
116
+ ...step,
117
+ body: typeof step.body === "string" ? step.body : step.body ? JSON.stringify(step.body) : ""
118
+ }));
119
+ const success = await blazeCore.runCorrelatedTransaction(sanitizedSteps);
135
120
  if (success) {
136
121
  console.log("Pipeline run complete. Parameter tracking successfully mitigated breaking changes.");
137
122
  }
@@ -190,31 +175,18 @@ function parseArguments(args) {
190
175
  if (trailingArgs[2]) targetErrorRate = parseFloat(trailingArgs[2]) / 100;
191
176
  }
192
177
  return {
193
- //[cite: 2]
194
178
  targetScript,
195
- //[cite: 2]
196
179
  isAgentic,
197
- //[cite: 2]
198
180
  isCorrelate,
199
- //[cite: 2]
200
181
  clusterLogs,
201
- //[cite: 2]
202
182
  threads,
203
- //[cite: 2]
204
183
  durationSec,
205
- //[cite: 2]
206
184
  targetApdex,
207
- //[cite: 2]
208
185
  targetErrorRate,
209
- //[cite: 2]
210
186
  maxThreads,
211
- //[cite: 2]
212
187
  stepSize: 15,
213
- //[cite: 2]
214
188
  maxAllowedLatencyMs,
215
- //[cite: 2]
216
189
  outputHtml
217
- //[cite: 2]
218
190
  };
219
191
  }
220
192
  async function runBlazeCoreEngine(config) {
@@ -263,23 +235,14 @@ async function runIntelligentAgenticStressTest(config) {
263
235
  globalMetricsAccumulator.latencies.push(metrics.avgLatencyMs);
264
236
  globalMetricsAccumulator.bandwidths.push(metrics.bandwidthMb);
265
237
  const currentState = {
266
- //[cite: 2]
267
238
  threads: currentThreads,
268
- //[cite: 2]
269
239
  avgLatency: metrics.avgLatencyMs,
270
- //[cite: 2]
271
240
  p95Latency: metrics.p95LatencyMs,
272
- //[cite: 2]
273
241
  errorRate: metrics.errorRate,
274
- //[cite: 2]
275
242
  apdex: metrics.apdexScore,
276
- //[cite: 2]
277
243
  throughput: metrics.requestsPerSecond,
278
- //[cite: 2]
279
244
  successRequests: metrics.c2xx + metrics.c3xx,
280
- //[cite: 2]
281
245
  failedRequests: metrics.c4xx + metrics.c5xx
282
- //[cite: 2]
283
246
  };
284
247
  printMatrixDashboard(metrics, currentThreads);
285
248
  history.push(currentState);
@@ -318,23 +281,14 @@ async function runIntelligentAgenticStressTest(config) {
318
281
  semanticReport = analyzer.process(aggregateErrorLogs);
319
282
  }
320
283
  const finalSummaryCards = {
321
- //[cite: 2]
322
284
  apdex: history[history.length - 1]?.apdex || 0,
323
- //[cite: 2]
324
285
  throughput: history[history.length - 1]?.throughput || 0,
325
- //[cite: 2]
326
286
  bandwidth: mathUtils.mean(globalMetricsAccumulator.bandwidths),
327
- //[cite: 2]
328
287
  ttfb: mathUtils.mean(globalMetricsAccumulator.ttfb),
329
- //[cite: 2]
330
288
  dns: mathUtils.mean(globalMetricsAccumulator.dns),
331
- //[cite: 2]
332
289
  tcp: mathUtils.mean(globalMetricsAccumulator.tcp),
333
- //[cite: 2]
334
290
  tls: mathUtils.mean(globalMetricsAccumulator.tls),
335
- //[cite: 2]
336
291
  stdDev: mathUtils.stdDev(globalMetricsAccumulator.latencies, mathUtils.mean(globalMetricsAccumulator.latencies))
337
- //[cite: 2]
338
292
  };
339
293
  generateFinalAgentReport(history);
340
294
  exportHtmlDashboard(history, config, verdictReason, semanticReport, { total2xx, total3xx, total4xx, total5xx }, finalSummaryCards);
@@ -344,23 +298,14 @@ async function runStandardStressTest(config) {
344
298
  const { metrics, rawErrors } = await runBlazeCoreEngine(config);
345
299
  printMatrixDashboard(metrics, config.threads);
346
300
  const history = [{
347
- //[cite: 2]
348
301
  threads: config.threads,
349
- //[cite: 2]
350
302
  avgLatency: metrics.avgLatencyMs,
351
- //[cite: 2]
352
303
  p95Latency: metrics.p95LatencyMs,
353
- //[cite: 2]
354
304
  errorRate: metrics.errorRate,
355
- //[cite: 2]
356
305
  apdex: metrics.apdexScore,
357
- //[cite: 2]
358
306
  throughput: metrics.requestsPerSecond,
359
- //[cite: 2]
360
307
  successRequests: metrics.c2xx + metrics.c3xx,
361
- //[cite: 2]
362
308
  failedRequests: metrics.c4xx + metrics.c5xx
363
- //[cite: 2]
364
309
  }];
365
310
  let semanticReport = null;
366
311
  if (config.clusterLogs && rawErrors.length > 0) {
@@ -368,33 +313,22 @@ async function runStandardStressTest(config) {
368
313
  semanticReport = analyzer.process(rawErrors);
369
314
  }
370
315
  const finalSummaryCards = {
371
- //[cite: 2]
372
316
  apdex: metrics.apdexScore,
373
- //[cite: 2]
374
317
  throughput: metrics.requestsPerSecond,
375
- //[cite: 2]
376
318
  bandwidth: metrics.bandwidthMb,
377
- //[cite: 2]
378
319
  ttfb: metrics.avgTtfbMs,
379
- //[cite: 2]
380
320
  dns: metrics.avgDnsMs,
381
- //[cite: 2]
382
321
  tcp: metrics.avgTcpMs,
383
- //[cite: 2]
384
322
  tls: metrics.avgTlsMs,
385
- //[cite: 2]
386
323
  stdDev: metrics.stdDevMs
387
- //[cite: 2]
388
324
  };
389
325
  const isPassed = metrics.apdexScore >= config.targetApdex && metrics.errorRate <= config.targetErrorRate;
390
326
  const verdictReason = isPassed ? "Static single-wave baseline checks concluded successfully without triggering health boundaries." : "Static verification loop completed with values exceeding defined quality thresholds.";
391
327
  exportHtmlDashboard(history, config, verdictReason, semanticReport, {
392
- //[cite: 2]
393
328
  total2xx: metrics.c2xx,
394
329
  total3xx: metrics.c3xx,
395
330
  total4xx: metrics.c4xx,
396
331
  total5xx: metrics.c5xx
397
- //[cite: 2]
398
332
  }, finalSummaryCards);
399
333
  }
400
334
  function generateSimulationData(threads, durationSec, maxAllowedLatencyMs) {
@@ -405,13 +339,9 @@ function generateSimulationData(threads, durationSec, maxAllowedLatencyMs) {
405
339
  const isBreached = threads > targetThresholdBreak;
406
340
  const stressFactor = isBreached ? Math.pow(threads / targetThresholdBreak, 1.5) : 1;
407
341
  const errorPool = [
408
- //[cite: 2]
409
342
  `Error: ECONNREFUSED 127.0.0.1:5432 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)`,
410
- //[cite: 2]
411
343
  `HTTP/1.1 504 Gateway Timeout on POST /api/v1/checkout - upstream socket drop after 15000ms`,
412
- //[cite: 2]
413
344
  `TypeError: Cannot read properties of undefined (reading 'config_id') at Object.execute (${path.sep}app${path.sep}dist${path.sep}handler.js:42:19)`
414
- //[cite: 2]
415
345
  ];
416
346
  for (let i = 0; i < totalRequests; i++) {
417
347
  const isError = Math.random() < (isBreached ? 0.05 : 1e-3);
@@ -423,21 +353,13 @@ function generateSimulationData(threads, durationSec, maxAllowedLatencyMs) {
423
353
  errorMessage = `[${(/* @__PURE__ */ new Date()).toISOString()}] ` + errorPool[Math.floor(Math.random() * errorPool.length)];
424
354
  }
425
355
  data.push({
426
- //[cite: 2]
427
356
  durationMs: isError ? baseLatency * 0.1 : baseLatency,
428
- //[cite: 2]
429
357
  timestampMs: startTime + Math.random() * (durationSec * 1e3),
430
- //[cite: 2]
431
358
  dnsTimeMs: 1 + Math.random() * 0.9,
432
- //[cite: 2]
433
359
  tcpTimeMs: 4 + Math.random() * 1.5,
434
- //[cite: 2]
435
360
  tlsTimeMs: 6 + Math.random() * 1.8,
436
- //[cite: 2]
437
361
  statusCode,
438
- //[cite: 2]
439
362
  errorMessage
440
- //[cite: 2]
441
363
  });
442
364
  }
443
365
  return data.sort((a, b) => a.timestampMs - b.timestampMs);
@@ -467,32 +389,22 @@ function processMetricsTelemetry(requests, durationSec) {
467
389
  const apdexScore = totalRequests === 0 ? 0 : (satisfied + tolerating / 2) / totalRequests;
468
390
  const bandwidthMb = totalRequests * 1.2 / durationSec / 10;
469
391
  return {
470
- //[cite: 2]
471
392
  totalRequests,
472
- //[cite: 2]
473
393
  requestsPerSecond: totalRequests / durationSec,
474
- //[cite: 2]
475
394
  avgLatencyMs,
476
- //[cite: 2]
477
395
  stdDevMs,
478
- //[cite: 2]
479
396
  p95LatencyMs,
480
- //[cite: 2]
481
397
  errorRate,
482
- //[cite: 2]
483
398
  apdexScore,
484
- //[cite: 2]
485
399
  c2xx,
486
400
  c3xx,
487
401
  c4xx,
488
402
  c5xx,
489
- //[cite: 2]
490
403
  avgDnsMs,
491
404
  avgTcpMs,
492
405
  avgTlsMs,
493
406
  avgTtfbMs,
494
407
  bandwidthMb
495
- //[cite: 2]
496
408
  };
497
409
  }
498
410
  function printMatrixDashboard(m, threads) {
@@ -607,8 +519,8 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
607
519
 
608
520
  .matrix-box { background: #131c2e; border: 1px solid #1e293b; border-radius: 8px; padding: 1.25rem; }
609
521
  .matrix-title { font-size: 1.1rem; font-weight: bold; color: #ffffff; margin-bottom: 1rem; }
610
- .matrix-row { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid #1e293b; }
611
- .matrix-row:last-child { border-bottom: none; }
522
+ .matrix-box .matrix-row { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid #1e293b; }
523
+ .matrix-box .matrix-row:last-child { border-bottom: none; }
612
524
  .matrix-label { font-size: 0.9rem; color: #f8fafc; display: flex; align-items: center; gap: 0.5rem; }
613
525
  .matrix-badge { font-size: 0.7rem; font-weight: bold; padding: 0.1rem 0.3rem; border-radius: 4px; }
614
526
  .badge-2xx { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
Binary file
package/index.node ADDED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "3.0.26",
3
+ "version": "3.0.29",
4
4
  "description": "A high-performance, multi-threaded load testing engine built with Rust and QuickJS.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,11 +18,10 @@
18
18
  "blaze.win32-x64-msvc.node"
19
19
  ],
20
20
  "scripts": {
21
- "prebuild": "node -e \"if (!fs.existsSync('dist')) fs.mkdirSync('dist')\"",
22
- "build:rust": "napi build --platform --release --js index.js --dts index.d.ts",
21
+ "prebuild": "node -e \"if (!fs.existsSync('dist')) fs.mkdirSync('dist')\"",
22
+ "build:rust": "napi build --platform --release --output-dir dist --js index.js --dts index.d.ts",
23
23
  "build:cli": "esbuild cli.ts --bundle --platform=node --format=esm --packages=external --outfile=dist/cli.js",
24
- "postbuild": "node -e \"fs.copyFileSync('index.win32-x64-msvc.node', 'dist/blaze.win32-x64-msvc.node'); fs.copyFileSync('index.js', 'dist/index.js')\"",
25
- "build": "npm run build:rust && npm run build:cli && npm run postbuild"
24
+ "build": "npm run prebuild && npm run build:rust && npm run build:cli"
26
25
  },
27
26
  "dependencies": {
28
27
  "esbuild": "^0.20.0"
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- const { runBlazeCore } = require('./blaze.win32-x64-msvc.node');
2
-
3
- module.exports = {
4
- runBlazeCore
5
- };