Skip to content

Commit

Permalink
fix: include original phase definition in phaseStarted/phaseCompleted…
Browse files Browse the repository at this point in the history
… events (#2203)
  • Loading branch information
hassy authored Oct 11, 2023
1 parent 9c51118 commit ba9baf5
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions packages/artillery/lib/launch-platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,18 @@ class Launcher {
typeof this.phaseStartedEventsSeen[message.phase.index] === 'undefined'
) {
this.phaseStartedEventsSeen[message.phase.index] = Date.now();
this.events.emit('phaseStarted', message.phase);
this.pluginEvents.emit('phaseStarted', message.phase);
this.pluginEventsLegacy.emit('phaseStarted', message.phase);

global.artillery.globalEvents.emit('phaseStarted', message.phase);
const fullPhase = {
//get back original phase without any splitting for workers
...this.script.config.phases[message.phase.index],
id: message.phase.id,
startTime: this.phaseStartedEventsSeen[message.phase.index]
};

this.events.emit('phaseStarted', fullPhase);
this.pluginEvents.emit('phaseStarted', fullPhase);
this.pluginEventsLegacy.emit('phaseStarted', fullPhase);

global.artillery.globalEvents.emit('phaseStarted', fullPhase);
}
});

Expand All @@ -111,10 +118,18 @@ class Launcher {
'undefined'
) {
this.phaseCompletedEventsSeen[message.phase.index] = Date.now();
this.events.emit('phaseCompleted', message.phase);
this.pluginEvents.emit('phaseCompleted', message.phase);
this.pluginEventsLegacy.emit('phaseCompleted', message.phase);
global.artillery.globalEvents.emit('phaseCompleted', message.phase);
const fullPhase = {
//get back original phase without any splitting for workers
...this.script.config.phases[message.phase.index],
id: message.phase.id,
startTime: this.phaseStartedEventsSeen[message.phase.index],
endTime: message.phase.endTime
};

this.events.emit('phaseCompleted', fullPhase);
this.pluginEvents.emit('phaseCompleted', fullPhase);
this.pluginEventsLegacy.emit('phaseCompleted', fullPhase);
global.artillery.globalEvents.emit('phaseCompleted', fullPhase);
}
});

Expand Down

0 comments on commit ba9baf5

Please sign in to comment.