blaze-performance-tester 3.2.18 → 3.2.20

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.
Files changed (2) hide show
  1. package/dist/cli.js +53 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5613,6 +5613,33 @@ function loadBaselineData(filePath) {
5613
5613
  }
5614
5614
  return null;
5615
5615
  }
5616
+ async function generateElifExplanation(metrics) {
5617
+ const apiKey = process.env.GEMINI_API_KEY;
5618
+ if (!apiKey) {
5619
+ console.warn("\u26A0\uFE0F Warning: GEMINI_API_KEY missing. Skipping ELIF plain-language breakdown.");
5620
+ return null;
5621
+ }
5622
+ console.log("\u{1F9E0} Querying Gemini 2.5 Flash for ELIF Performance Breakdown...");
5623
+ const prompt = `
5624
+ You are a friendly, witty performance coach.
5625
+ Analyze the following JSON performance metrics and explain them as if the user is 5 years old.
5626
+ Use fun, relatable analogies (like a crowded amusement park ride or a highway toll booth) instead of technical jargon like p99 or thread contention. Keep it concise, encouraging, and clear.
5627
+
5628
+ Metrics:
5629
+ ${JSON.stringify(metrics, null, 2)}
5630
+ `;
5631
+ try {
5632
+ const ai = new GoogleGenAI({});
5633
+ const response = await ai.models.generateContent({
5634
+ model: "gemini-2.5-flash",
5635
+ contents: prompt
5636
+ });
5637
+ return response.text || "Could not generate ELIF explanation.";
5638
+ } catch (error) {
5639
+ console.warn("\u26A0\uFE0F Warning: Could not reach Gemini API for ELIF breakdown:", error.message || error);
5640
+ return null;
5641
+ }
5642
+ }
5616
5643
  async function generateGeminiRCA(history, finalSummary, errorLogs) {
5617
5644
  const apiKey = process.env.GEMINI_API_KEY;
5618
5645
  if (!apiKey) {
@@ -5804,6 +5831,7 @@ function parseArguments(args) {
5804
5831
  let maxAllowedLatencyMs = 800;
5805
5832
  let outputHtml = "blaze-dashboard.html";
5806
5833
  let baselinePath = null;
5834
+ let optionValue = null;
5807
5835
  const threadsIdx = args.indexOf("--threads");
5808
5836
  if (threadsIdx !== -1)
5809
5837
  threads = parseInt(args[threadsIdx + 1], 10);
@@ -5818,7 +5846,7 @@ function parseArguments(args) {
5818
5846
  rampDownSec = parseInt(args[rampDownIdx + 1], 10);
5819
5847
  const apdexIdx = args.indexOf("--target-apdex");
5820
5848
  if (apdexIdx !== -1)
5821
- targetApdex = parseFloat(args[apdexIdx + 1]);
5849
+ targetApdex = parseFloat(apdexIdx + 1);
5822
5850
  const errorIdx = args.indexOf("--target-error");
5823
5851
  if (errorIdx !== -1)
5824
5852
  targetErrorRate = parseFloat(args[errorIdx + 1]);
@@ -5831,6 +5859,10 @@ function parseArguments(args) {
5831
5859
  const baselineIdx = args.indexOf("--baseline");
5832
5860
  if (baselineIdx !== -1)
5833
5861
  baselinePath = args[baselineIdx + 1];
5862
+ const optionIdx = args.indexOf("--option");
5863
+ if (optionIdx !== -1 && args[optionIdx + 1]) {
5864
+ optionValue = args[optionIdx + 1];
5865
+ }
5834
5866
  const positionalNums = args.slice(1).filter((arg) => !arg.startsWith("-")).map(Number).filter((n) => !isNaN(n));
5835
5867
  if (positionalNums.length > 0 && threadsIdx === -1 && !isAgentic)
5836
5868
  threads = positionalNums[0];
@@ -5870,7 +5902,9 @@ function parseArguments(args) {
5870
5902
  stepSize: 15,
5871
5903
  maxAllowedLatencyMs,
5872
5904
  outputHtml,
5873
- baselinePath
5905
+ baselinePath,
5906
+ optionValue
5907
+ // Return optionValue in configuration object
5874
5908
  };
5875
5909
  }
5876
5910
  async function runBlazeCoreEngine(config) {
@@ -6032,6 +6066,14 @@ async function runIntelligentAgenticStressTest(config) {
6032
6066
  };
6033
6067
  generateFinalAgentReport(history, healthScore);
6034
6068
  const geminiAnalysisHtml = await generateGeminiRCA(history, finalSummaryCards, aggregateErrorLogs);
6069
+ if (config.optionValue === "elif") {
6070
+ const plainEnglishSummary = await generateElifExplanation(finalSummaryCards);
6071
+ if (plainEnglishSummary) {
6072
+ console.log("\n--- \u{1F9F8} ELIF Performance Breakdown ---");
6073
+ console.log(plainEnglishSummary);
6074
+ console.log("-------------------------------------\n");
6075
+ }
6076
+ }
6035
6077
  if (config.isSeo) {
6036
6078
  const finalLat = finalState.avgLatency || finalSummaryCards.ttfb;
6037
6079
  const seo = calculateSeoImpactMetrics(finalLat);
@@ -6086,6 +6128,14 @@ async function runStandardStressTest(config) {
6086
6128
  const isPassed = metrics.apdexScore >= config.targetApdex && metrics.errorRate <= config.targetErrorRate;
6087
6129
  const verdictReason = isPassed ? "Static single-wave baseline checks concluded successfully without triggering health boundaries." : "Static verification loop completed with values exceeding defined quality thresholds.";
6088
6130
  const geminiAnalysisHtml = await generateGeminiRCA(history, finalSummaryCards, rawErrors.length > 0 ? rawErrors : getFallbackClusterLogs());
6131
+ if (config.optionValue === "elif") {
6132
+ const plainEnglishSummary = await generateElifExplanation(finalSummaryCards);
6133
+ if (plainEnglishSummary) {
6134
+ console.log("\n--- \u{1F9F8} ELIF Performance Breakdown ---");
6135
+ console.log(plainEnglishSummary);
6136
+ console.log("-------------------------------------\n");
6137
+ }
6138
+ }
6089
6139
  if (config.isSeo) {
6090
6140
  const seo = calculateSeoImpactMetrics(metrics.avgLatencyMs);
6091
6141
  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}].`);
@@ -6965,7 +7015,7 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
6965
7015
  function printUsage() {
6966
7016
  console.log(`Blaze Core Performance Test CLI Engine
6967
7017
  Options:
6968
- --threads <count> | --duration <seconds> | --baseline <json_file> | --output <html_file>`);
7018
+ --threads <count> | --duration <seconds> | --baseline <json_file> | --output <html_file> | --option elif`);
6969
7019
  }
6970
7020
  runCli().catch(console.error);
6971
7021
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "3.2.18",
3
+ "version": "3.2.20",
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",