blaze-performance-tester 3.1.19 → 3.1.21

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/cli.js CHANGED
@@ -246,6 +246,8 @@ async function runIntelligentAgenticStressTest(config) {
246
246
  let aggregateErrorLogs = [];
247
247
  let lastRawRequests = [];
248
248
  let total1xx = 0, total2xx = 0, total3xx = 0, total4xx = 0, total5xx = 0;
249
+ let totalRequestsAccumulator = 0;
250
+ const globalCodeCounts = { 400: 0, 401: 0, 403: 0, 404: 0, 429: 0, 500: 0, 502: 0, 503: 0, 504: 0 };
249
251
  let globalMetricsAccumulator = { dns: [], tcp: [], tls: [], ttfb: [], latencies: [], bandwidths: [] };
250
252
  let currentThreads = Math.min(config.maxThreads, Math.max(5, Math.floor(config.maxThreads * 0.2)));
251
253
  let baseStep = config.stepSize;
@@ -264,6 +266,11 @@ async function runIntelligentAgenticStressTest(config) {
264
266
  total3xx += metrics.c3xx;
265
267
  total4xx += metrics.c4xx;
266
268
  total5xx += metrics.c5xx;
269
+ totalRequestsAccumulator += metrics.totalRequests;
270
+ const targetCodes = [400, 401, 403, 404, 429, 500, 502, 503, 504];
271
+ targetCodes.forEach((code) => {
272
+ globalCodeCounts[code] += metrics.codeCounts[code];
273
+ });
267
274
  globalMetricsAccumulator.dns.push(metrics.avgDnsMs);
268
275
  globalMetricsAccumulator.tcp.push(metrics.avgTcpMs);
269
276
  globalMetricsAccumulator.tls.push(metrics.avgTlsMs);
@@ -337,7 +344,11 @@ async function runIntelligentAgenticStressTest(config) {
337
344
  const seo = calculateSeoImpactMetrics(finalLat);
338
345
  console.log(`\u{1F50E} [SEO Impact Report]: Target latency under stress (${finalLat.toFixed(1)}ms) triggers a predicted Search Visibility Loss of -${seo.trafficLoss}% [Status: ${seo.status}].`);
339
346
  }
340
- exportHtmlDashboard(history, config, verdictReason, semanticReport, { total1xx, total2xx, total3xx, total4xx, total5xx }, finalSummaryCards, lastRawRequests);
347
+ const breakdownRates = {};
348
+ Object.keys(globalCodeCounts).forEach((code) => {
349
+ breakdownRates[code] = totalRequestsAccumulator === 0 ? 0 : globalCodeCounts[code] / totalRequestsAccumulator * 100;
350
+ });
351
+ exportHtmlDashboard(history, config, verdictReason, semanticReport, { total1xx, total2xx, total3xx, total4xx, total5xx, breakdownRates }, finalSummaryCards, lastRawRequests);
341
352
  }
342
353
  async function runStandardStressTest(config) {
343
354
  console.log(`\u{1F3CB}\uFE0F Running Standard Stress Test [Threads: ${config.threads} | Duration: ${config.durationSec}s]`);
@@ -377,12 +388,17 @@ async function runStandardStressTest(config) {
377
388
  const seo = calculateSeoImpactMetrics(metrics.avgLatencyMs);
378
389
  console.log(`\u{1F50E} [SEO Impact Report]: Target latency (${metrics.avgLatencyMs.toFixed(1)}ms) triggers a predicted Search Visibility Loss of -${seo.trafficLoss}% [Status: ${seo.status}].`);
379
390
  }
391
+ const breakdownRates = {};
392
+ Object.keys(metrics.codeCounts).forEach((code) => {
393
+ breakdownRates[code] = metrics.totalRequests === 0 ? 0 : metrics.codeCounts[code] / metrics.totalRequests * 100;
394
+ });
380
395
  exportHtmlDashboard(history, config, verdictReason, semanticReport, {
381
396
  total1xx: metrics.c1xx,
382
397
  total2xx: metrics.c2xx,
383
398
  total3xx: metrics.c3xx,
384
399
  total4xx: metrics.c4xx,
385
- total5xx: metrics.c5xx
400
+ total5xx: metrics.c5xx,
401
+ breakdownRates
386
402
  }, finalSummaryCards, rawRequests);
387
403
  }
388
404
  function getFallbackClusterLogs() {
@@ -411,7 +427,8 @@ function generateSimulationData(threads, durationSec, maxAllowedLatencyMs) {
411
427
  let errorMessage;
412
428
  let statusCode = 200;
413
429
  if (isError) {
414
- statusCode = Math.random() > 0.3 ? 500 : 404;
430
+ const targetResponseCodes = [400, 401, 403, 404, 429, 500, 502, 503, 504];
431
+ statusCode = targetResponseCodes[Math.floor(Math.random() * targetResponseCodes.length)];
415
432
  errorMessage = errorPool[Math.floor(Math.random() * errorPool.length)];
416
433
  }
417
434
  data.push({
@@ -437,12 +454,16 @@ function processMetricsTelemetry(requests, durationSec) {
437
454
  const avgTlsMs = mathUtils.mean(requests.map((r) => r.tlsTimeMs || 0));
438
455
  const avgTtfbMs = avgDnsMs + avgTcpMs + avgTlsMs + avgLatencyMs * 0.3;
439
456
  let c1xx = 0, c2xx = 0, c3xx = 0, c4xx = 0, c5xx = 0;
457
+ const codeCounts = { 400: 0, 401: 0, 403: 0, 404: 0, 429: 0, 500: 0, 502: 0, 503: 0, 504: 0 };
440
458
  requests.forEach((r) => {
441
459
  if (r.statusCode >= 100 && r.statusCode < 200) c1xx++;
442
460
  else if (r.statusCode >= 200 && r.statusCode < 300) c2xx++;
443
461
  else if (r.statusCode >= 300 && r.statusCode < 400) c3xx++;
444
462
  else if (r.statusCode >= 400 && r.statusCode < 500) c4xx++;
445
463
  else if (r.statusCode >= 500) c5xx++;
464
+ if (r.statusCode in codeCounts) {
465
+ codeCounts[r.statusCode]++;
466
+ }
446
467
  });
447
468
  const errorCount = c4xx + c5xx;
448
469
  const errorRate = totalRequests === 0 ? 0 : errorCount / totalRequests;
@@ -468,7 +489,8 @@ function processMetricsTelemetry(requests, durationSec) {
468
489
  avgTcpMs,
469
490
  avgTlsMs,
470
491
  avgTtfbMs,
471
- bandwidthMb
492
+ bandwidthMb,
493
+ codeCounts
472
494
  };
473
495
  }
474
496
  function printMatrixDashboard(m, threads) {
@@ -576,7 +598,9 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
576
598
  <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;">
577
599
  <div style="background: #090d16; padding: 1.25rem; border-radius: 6px; border: 1px solid #1e293b; text-align: center;">
578
600
  <div class="card-title" style="color: #94a3b8;">Est. Organic Traffic Loss</div>
579
- <div style="font-size: 2rem; font-weight: bold; color: ${seoMetrics.color};">-${seoMetrics.trafficLoss}%</div>
601
+ <div style="font-size: 2rem; font-weight: bold; color: ${seoMetrics.color};">
602
+ ${seoMetrics.trafficLoss > 0 ? "-" : ""}${seoMetrics.trafficLoss}%
603
+ </div>
580
604
  <div style="font-size: 0.8rem; color: #64748b; margin-top: 0.25rem;">compared to 200ms sweet-spot</div>
581
605
  </div>
582
606
  <div style="background: #090d16; padding: 1.25rem; border-radius: 6px; border: 1px solid #1e293b;">
@@ -635,6 +659,17 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
635
659
  </div>
636
660
  </div>
637
661
  </div>`;
662
+ const breakdownRates = responseMatrix.breakdownRates || {};
663
+ const breakdownGridHtml = [400, 401, 403, 404, 429, 500, 502, 503, 504].map((code) => {
664
+ const rate = breakdownRates[code] || 0;
665
+ const displayColor = rate > 0 ? code >= 500 ? "#f87171" : "#fde047" : "#64748b";
666
+ return `
667
+ <div style="background: #090d16; border: 1px solid #1e293b; border-radius: 4px; padding: 0.4rem 0.2rem; text-align: center;">
668
+ <div style="font-size: 0.7rem; color: #64748b; font-weight: bold;">${code}</div>
669
+ <div style="font-size: 0.85rem; font-weight: bold; color: ${displayColor};">${rate.toFixed(2)}%</div>
670
+ </div>
671
+ `;
672
+ }).join("");
638
673
  const htmlContent = `<!DOCTYPE html><html lang="en"><head>
639
674
  <meta charset="UTF-8">
640
675
  <title>Blaze Core Performance Report</title>
@@ -759,6 +794,14 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
759
794
  <div class="matrix-label">Server Error <span class="matrix-badge badge-5xx">5xx</span></div>
760
795
  <div class="matrix-value">${responseMatrix.total5xx}</div>
761
796
  </div>
797
+
798
+ <!-- NEW SUBSECTION: Individual HTTP Status Code Breakdown Rates -->
799
+ <div class="matrix-title" style="margin-top: 1.5rem; font-size: 0.85rem; border-top: 1px solid #1e293b; padding-top: 1rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em;">
800
+ \u{1F522} HTTP Status Code Breakdown Rate
801
+ </div>
802
+ <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.5rem;">
803
+ ${breakdownGridHtml}
804
+ </div>
762
805
  </div>
763
806
  </div>
764
807
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "3.1.19",
3
+ "version": "3.1.21",
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",