Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent incorrect "multiple metric batches" warning in tests with pause phases #3331

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading