Skip to content

Commit

Permalink
fix(apdex): emit metrics with zero explicitly (#2213)
Browse files Browse the repository at this point in the history
  • Loading branch information
InesNi authored Oct 13, 2023
1 parent 683e569 commit 77ea3e9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/artillery-plugin-apdex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ class ApdexPlugin {

function apdexAfterResponse(req, res, userContext, events, done) {
const total = res.timings.phases.total;
const counts = {};
events.emit('counter', METRICS.satisfied, 0);
events.emit('counter', METRICS.tolerated, 0);
events.emit('counter', METRICS.frustrated, 0);

if (total <= t) {
counts.satisfied = 1;
events.emit('counter', METRICS.satisfied, 1);
} else if (total <= 4 * t) {
counts.tolerated = 1;
events.emit('counter', METRICS.tolerated, 1);
} else {
counts.frustrated = 1;
events.emit('counter', METRICS.frustrated, 1);
}
events.emit('counter', METRICS.satisfied, counts.satisfied);
events.emit('counter', METRICS.tolerated, counts.tolerated);
events.emit('counter', METRICS.frustrated, counts.frustrated);

return done();
}
Expand Down

0 comments on commit 77ea3e9

Please sign in to comment.