blaze-performance-tester 1.1.2 → 1.1.4

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
@@ -22,16 +22,36 @@ if (!fs.existsSync(targetScriptPath)) {
22
22
  console.error(`\x1B[31m\u274C Target workload script not found at:\x1B[0m ${targetScriptPath}`);
23
23
  process.exit(1);
24
24
  }
25
- var currentWorkingDirectory = process.cwd();
26
- var resultsFolder = path.join(currentWorkingDirectory, "results");
25
+ var resultsFolder = path.join(process.cwd(), "results");
27
26
  if (!fs.existsSync(resultsFolder)) {
28
27
  fs.mkdirSync(resultsFolder, { recursive: true });
29
28
  }
30
29
  var csvOutputPath = path.join(resultsFolder, "summary_report.csv");
31
- console.log(`\x1B[35m\u{1F525} Blaze Performance Tester Initialized... \x1B[0m`);
32
- console.log(`\u26A1 Spawning \x1B[32m${vusCount}\x1B[0m Virtual Users for \x1B[32m${durationSeconds}s\x1B[0m against scenario script.`);
30
+ console.log(`\x1B[33m\u{1F525} [Blaze] Injecting load tests using Blaze metrics aggregation engine...\x1B[0m
31
+ `);
33
32
  try {
34
- nativeBinding.runBlazeCore(targetScriptPath, vusCount, durationSeconds, csvOutputPath);
33
+ const metrics = nativeBinding.runBlazeCore(targetScriptPath, vusCount, durationSeconds, csvOutputPath);
34
+ const actualDurationSec = metrics.execution_duration_ms / 1e3;
35
+ const throughput = (metrics.total_requests / actualDurationSec).toFixed(2);
36
+ const errorRate = (metrics.failed_requests / (metrics.total_requests || 1) * 100).toFixed(2);
37
+ console.log(`\u{1F4CA} ==================== Blaze Performance Report ====================`);
38
+ console.log(` Target Script: ${targetScript}`);
39
+ console.log(` Active VUs: ${vusCount} parallel threads`);
40
+ console.log(` Elapsed Time: ${actualDurationSec.toFixed(2)} seconds`);
41
+ console.log(`-----------------------------------------------------------------------------`);
42
+ console.log(` Samples (Requests): ${metrics.total_requests}`);
43
+ console.log(` Throughput Rate: ${throughput} req/sec`);
44
+ console.log(` Error Rate: ${errorRate}% (${metrics.failed_requests} failed)`);
45
+ console.log(`-----------------------------------------------------------------------------`);
46
+ console.log(`\u{1F4C8} Latency Statistics (ms):`);
47
+ console.log(` \u251C\u2500\u2500 Minimum: ${metrics.min_latency_ms.toFixed(2)} ms`);
48
+ console.log(` \u251C\u2500\u2500 Average: ${metrics.avg_latency_ms.toFixed(2)} ms`);
49
+ console.log(` \u251C\u2500\u2500 Median (50%): ${metrics.p50_latency_ms.toFixed(2)} ms`);
50
+ console.log(` \u251C\u2500\u2500 90th %ile: ${metrics.p90_latency_ms.toFixed(2)} ms`);
51
+ console.log(` \u251C\u2500\u2500 95th %ile: ${metrics.p95_latency_ms.toFixed(2)} ms`);
52
+ console.log(` \u251C\u2500\u2500 99th %ile: ${metrics.p99_latency_ms.toFixed(2)} ms`);
53
+ console.log(` \u2514\u2500\u2500 Maximum: ${metrics.max_latency_ms.toFixed(2)} ms`);
54
+ console.log(`=============================================================================`);
35
55
  } catch (error) {
36
56
  console.error("\x1B[31m\u{1F4A5} Critical Native Core Execution Error:\x1B[0m", error);
37
57
  process.exit(1);
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ const nativeBinding = require('./blaze.win32-x64-msvc.node');
4
+
5
+ export const runBlazeCore = nativeBinding.runBlazeCore;
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ const nativeBinding = require('./blaze.win32-x64-msvc.node');
4
+
5
+ export const runBlazeCore = nativeBinding.runBlazeCore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
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",
@@ -13,13 +13,14 @@
13
13
  "files": [
14
14
  "dist",
15
15
  "bin.js",
16
+ "index.js",
16
17
  "blaze.win32-x64-msvc.node"
17
18
  ],
18
19
  "scripts": {
19
20
  "prebuild": "node -e \"if (!fs.existsSync('dist')) fs.mkdirSync('dist')\"",
20
- "build:rust": "napi build --platform --release --js dist/index.js --dts dist/index.d.ts",
21
+ "build:rust": "napi build --platform --release --js index.js --dts index.d.ts",
21
22
  "build:cli": "esbuild cli.ts --bundle --platform=node --format=esm --packages=external --outfile=dist/cli.js",
22
- "postbuild": "node -e \"fs.copyFileSync('blaze.win32-x64-msvc.node', 'dist/blaze.win32-x64-msvc.node')\"",
23
+ "postbuild": "node -e \"fs.copyFileSync('blaze.win32-x64-msvc.node', 'dist/blaze.win32-x64-msvc.node'); fs.copyFileSync('index.js', 'dist/index.js')\"",
23
24
  "build": "npm run build:rust && npm run build:cli && npm run postbuild"
24
25
  },
25
26
  "dependencies": {