Skip to content

Commit

Permalink
initialization of responses
Browse files Browse the repository at this point in the history
  • Loading branch information
bgardner87 committed Jan 21, 2018
1 parent 422f214 commit f2c94ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/helpers/on-headers-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ module.exports = (statusCode, startTime, spans) => {
const category = Math.floor(statusCode / 100);

spans.forEach((span) => {
const last = span.responses[span.responses.length - 1];
let { responses } = span;

if (!responses) {
responses = [];
}

const last = responses[span.responses.length - 1];
if (last !== undefined && (last.timestamp / 1000) + span.interval > Date.now() / 1000) {
last[category] += 1;
last.count += 1;
Expand Down

0 comments on commit f2c94ed

Please sign in to comment.