Skip to content

Commit 46e0bca

Browse files
committed
fix(http): use the statusCode from the writeHead too
1 parent 585858c commit 46e0bca

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/instrumentations/core/http/server.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ function wrapListener (listener, agent, mustCollectStore) {
9191

9292
response.once('finish', instrumentedFinish)
9393

94-
response.writeHead = function () {
94+
response.writeHead = function (statusCode) {
95+
var _statusCode = statusCode || response.statusCode
96+
9597
serverSendTime = microtime.now()
9698

9799
// collected because previous reason like (x-must-collect etc.) or wrong status code
98-
if (response.statusCode > 399) {
100+
if (_statusCode > 399) {
99101
mustCollectStore[requestId] = consts.MUST_COLLECT.ERROR
100102
}
101103

0 commit comments

Comments
 (0)