Skip to content

Commit

Permalink
Merge pull request #3331 from artilleryio/fix/multiple-batches-with-p…
Browse files Browse the repository at this point in the history
…ause

fix: prevent incorrect "multiple metric batches" warning in tests with pause phases
  • Loading branch information
hassy authored Aug 30, 2024
2 parents d3f06a7 + c33e6b4 commit 917e521
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
7 changes: 0 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions packages/artillery/lib/launch-platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { loadPlugins, loadPluginsConfig } = require('./load-plugins');
const EventEmitter = require('eventemitter3');
const debug = require('debug')('core');

const os = require('os');
const p = require('util').promisify;
const _ = require('lodash');

Expand Down Expand Up @@ -41,7 +40,6 @@ class Launcher {
this.workerMessageBuffer = [];

this.metricsByPeriod = {}; // individual intermediates by worker
this.mergedPeriodMetrics = []; // merged intermediates for a period
this.finalReportsByWorker = {};

this.events = new EventEmitter();
Expand Down Expand Up @@ -378,18 +376,18 @@ class Launcher {
);

// TODO: Track how many workers provided metrics in the metrics report
const stats = SSMS.mergeBuckets(this.metricsByPeriod[String(period)])[
String(period)
];
this.mergedPeriodMetrics.push(stats);
// summarize histograms for console reporter
// summarize histograms for console reporter:
const merged = SSMS.mergeBuckets(this.metricsByPeriod[String(period)]);
const stats = merged[String(period)];

stats.summaries = {};
for (const [name, value] of Object.entries(stats.histograms || {})) {
const summary = SSMS.summarizeHistogram(value);
stats.summaries[name] = summary;
delete this.metricsByPeriod[String(period)];
}

delete this.metricsByPeriod[String(period)];

this.periodsReportedFor.push(period);
this.pluginEvents.emit('stats', stats);
global.artillery.globalEvents.emit('stats', stats);
Expand Down
1 change: 0 additions & 1 deletion packages/artillery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
"sqs-consumer": "5.8.0",
"temp": "^0.9.4",
"tmp": "0.2.1",
"try-require": "^1.2.1",
"walk-sync": "^0.2.3",
"yaml-js": "^0.2.3"
},
Expand Down
9 changes: 0 additions & 9 deletions packages/core/lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ const _ = require('lodash');
const debug = require('debug')('runner');
const debugPerf = require('debug')('perf');
const uuidv4 = require('uuid').v4;
const A = require('async');
const { SSMS } = require('./ssms');
const tryResolve = require('try-require').resolve;
const createPhaser = require('./phases');
const isIdlePhase = require('./is-idle-phase');
const createReader = require('./readers');
const engineUtil = require('@artilleryio/int-commons').engine_util;
const wl = require('./weighted-pick');
Expand Down Expand Up @@ -223,15 +220,9 @@ function run(script, ee, options, runState, contextVars) {
});
phaser.on('phaseStarted', function (spec) {
ee.emit('phaseStarted', spec);
if (isIdlePhase(spec)) {
ee.emit('stats', SSMS.empty());
}
});
phaser.on('phaseCompleted', function (spec) {
ee.emit('phaseCompleted', spec);
if (isIdlePhase(spec)) {
ee.emit('stats', SSMS.empty());
}
});
phaser.on('done', function () {
debug('All phases launched');
Expand Down
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"socket.io-client": "^4.5.1",
"socketio-wildcard": "^2.0.0",
"tough-cookie": "^5.0.0-rc.2",
"try-require": "^1.2.1",
"uuid": "^8.0.0",
"ws": "^7.5.7"
},
Expand Down

0 comments on commit 917e521

Please sign in to comment.