blaze-performance-tester 3.1.48 → 3.1.50

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
@@ -27,6 +27,42 @@ var LogAnalyzer = class {
27
27
  }
28
28
  return { category: "Product_Error", severity: "WARNING" };
29
29
  }
30
+ /**
31
+ * Generates actionable architectural and code-level fixes based on log structural fingerprints
32
+ */
33
+ generatePlaybook(template, severity) {
34
+ if (severity !== "CRITICAL" && severity !== "HIGH") {
35
+ return void 0;
36
+ }
37
+ if (template.includes("ECONNREFUSED") || template.includes("5432")) {
38
+ return `**Database Connectivity Failure**
39
+ 1. **Service Triage:** Verify the target PostgreSQL instance at 127.0.0.1:5432 is running using \`pg_isready\`.
40
+ 2. **Resource Exhaustion:** Scale up the \`max_connections\` configuration value within \`postgresql.conf\`.
41
+ 3. **Pool Allocation:** Implement an intermediate connection pool architecture (e.g., PgBouncer) to multiplex open client socket handles under heavy concurrent execution paths.`;
42
+ }
43
+ if (template.includes("504 Gateway Timeout") || template.includes("upstream socket drop")) {
44
+ return `**Upstream Gateway Timeout Saturation**
45
+ 1. **Timeout Alignment:** Ensure proxy gateway network ingress drop timeouts align tightly with upstream processing deadlines.
46
+ 2. **Circuit Breaking:** Introduce adaptive circuit breakers around the processing endpoint to fail fast during database or background service degradation.
47
+ 3. **Async Offloading:** Convert synchronous compute-intensive requests into persistent asynchronous worker jobs managed via message queues.`;
48
+ }
49
+ if (template.includes("TypeError") || template.includes("Cannot read properties")) {
50
+ return `**Unsafe Object Property Reference Exception**
51
+ 1. **Defensive Programming:** Utilize optional chaining constructs (\`target?.config_id\`) across dynamic payload parsing loops.
52
+ 2. **Schema Validation:** Implement explicit object shape assertions using schemas (e.g., Zod, Ajv) at system entry layers before handler invocation loops execute.
53
+ 3. **Fallback Defaults:** Apply default assignments or fallback configuration structures to isolate null pointer references from propagating.`;
54
+ }
55
+ if (template.includes("JsonWebTokenError") || template.includes("jwt expired")) {
56
+ return `**Identity Token Lifecycle Expiry**
57
+ 1. **Session Handshake:** Implement an active sliding token expiration strategy or split verification out into discrete sliding refresh cycles.
58
+ 2. **Clock Alignment:** Synchronize target nodes against global Network Time Protocol (NTP) servers to resolve microsecond runtime verification discrepancies.
59
+ 3. **Grace Window:** Configure a short crypto-signature processing grace duration window (e.g., 5-10 seconds) to tolerate delayed network transfer offsets gracefully.`;
60
+ }
61
+ return `**High-Severity System Anomaly Action Plan**
62
+ 1. **Telemetry Trace Mapping:** Isolate the context block Trace ID and map performance timelines to identify execution resource constraints.
63
+ 2. **Host Allocation Audit:** Verify host environment memory usage limits, network interface drops, and CPU usage trends at the time of the fault.
64
+ 3. **Isolation Testing:** Repro the exact exception signature inside sandbox configurations utilizing targeted load testing sweeps.`;
65
+ }
30
66
  /**
31
67
  * Processes a stream of raw textual error logs into deduplicated clustered fingerprints
32
68
  */
@@ -77,7 +113,10 @@ var LogAnalyzer = class {
77
113
  clusterMap[template].examples.push(log);
78
114
  }
79
115
  }
80
- const sortedClusters = Object.values(clusterMap).sort((a, b) => b.count - a.count);
116
+ const sortedClusters = Object.values(clusterMap).map((cluster) => {
117
+ cluster.playbook = this.generatePlaybook(cluster.template, cluster.severity);
118
+ return cluster;
119
+ }).sort((a, b) => b.count - a.count);
81
120
  return {
82
121
  uniqueClustersCount: sortedClusters.length,
83
122
  totalCapturedErrors,
@@ -345,9 +384,9 @@ async function runIntelligentAgenticStressTest(config) {
345
384
  let total1xx = 0, total2xx = 0, total3xx = 0, total4xx = 0, total5xx = 0;
346
385
  let totalRequestsAccumulator = 0;
347
386
  const globalCodeCounts = { 400: 0, 401: 0, 403: 0, 404: 0, 429: 0, 500: 0, 502: 0, 503: 0, 504: 0 };
348
- let globalMetricsAccumulator = { dns: [], tcp: [], tls: [], ttfb: [], latencies: [], bandwidths: [] };
387
+ const globalMetricsAccumulator = { dns: [], tcp: [], tls: [], ttfb: [], latencies: [], bandwidths: [] };
349
388
  let currentThreads = Math.min(config.maxThreads, Math.max(5, Math.floor(config.maxThreads * 0.2)));
350
- let baseStep = config.stepSize;
389
+ const baseStep = config.stepSize;
351
390
  let isStable = true;
352
391
  let verdictReason = "The system successfully scaled and remained stable within parameters up to maximum configured capacity allocations.";
353
392
  let saturationKneePoint = null;
@@ -366,7 +405,7 @@ async function runIntelligentAgenticStressTest(config) {
366
405
  totalRequestsAccumulator += metrics.totalRequests;
367
406
  const targetCodes = [400, 401, 403, 404, 429, 500, 502, 503, 504];
368
407
  targetCodes.forEach((code) => {
369
- globalCodeCounts[code] += metrics.codeCounts[code];
408
+ globalCodeCounts[code] += metrics.codeCounts[code] || 0;
370
409
  });
371
410
  globalMetricsAccumulator.dns.push(metrics.avgDnsMs);
372
411
  globalMetricsAccumulator.tcp.push(metrics.avgTcpMs);
@@ -424,7 +463,7 @@ async function runIntelligentAgenticStressTest(config) {
424
463
  const analyzer = new LogAnalyzer();
425
464
  semanticReport = analyzer.process(aggregateErrorLogs);
426
465
  }
427
- const finalState = history[history.length - 1] || { apdex: 0, errorRate: 0, p95Latency: 0, throughput: 0 };
466
+ const finalState = history[history.length - 1] || { apdex: 0, errorRate: 0, p95Latency: 0, throughput: 0, threads: 50 };
428
467
  const healthScore = computeHealthScoreValue(finalState.apdex, finalState.errorRate, finalState.p95Latency, config.maxAllowedLatencyMs);
429
468
  const finalSummaryCards = {
430
469
  apdex: finalState.apdex,
@@ -446,7 +485,8 @@ async function runIntelligentAgenticStressTest(config) {
446
485
  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}].`);
447
486
  }
448
487
  const breakdownRates = {};
449
- Object.keys(globalCodeCounts).forEach((code) => {
488
+ Object.keys(globalCodeCounts).forEach((codeStr) => {
489
+ const code = Number(codeStr);
450
490
  breakdownRates[code] = totalRequestsAccumulator === 0 ? 0 : globalCodeCounts[code] / totalRequestsAccumulator * 100;
451
491
  });
452
492
  exportHtmlDashboard(history, config, verdictReason, semanticReport, { total1xx, total2xx, total3xx, total4xx, total5xx, breakdownRates }, finalSummaryCards, lastRawRequests, geminiAnalysisHtml);
@@ -494,7 +534,8 @@ async function runStandardStressTest(config) {
494
534
  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}].`);
495
535
  }
496
536
  const breakdownRates = {};
497
- Object.keys(metrics.codeCounts).forEach((code) => {
537
+ Object.keys(metrics.codeCounts).forEach((codeStr) => {
538
+ const code = Number(codeStr);
498
539
  breakdownRates[code] = metrics.totalRequests === 0 ? 0 : metrics.codeCounts[code] / metrics.totalRequests * 100;
499
540
  });
500
541
  exportHtmlDashboard(history, config, verdictReason, semanticReport, {
@@ -559,7 +600,7 @@ function processMetricsTelemetry(requests, durationSec) {
559
600
  const avgTlsMs = mathUtils.mean(requests.map((r) => r.tlsTimeMs || 0));
560
601
  const avgTtfbMs = avgDnsMs + avgTcpMs + avgTlsMs + avgLatencyMs * 0.3;
561
602
  let c1xx = 0, c2xx = 0, c3xx = 0, c4xx = 0, c5xx = 0;
562
- const codeCounts = { 400: 0, 401: 0, 403: 0, 404: 0, 429: 0, 500: 502, 503: 0, 504: 0 };
603
+ const codeCounts = { 400: 0, 401: 0, 403: 0, 404: 0, 429: 0, 500: 0, 502: 0, 503: 0, 504: 0 };
563
604
  [400, 401, 403, 404, 429, 500, 502, 503, 504].forEach((c) => codeCounts[c] = 0);
564
605
  requests.forEach((r) => {
565
606
  if (r.statusCode >= 100 && r.statusCode < 200) c1xx++;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "3.1.48",
3
+ "version": "3.1.50",
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",