Skip to content

Commit 0997b3d

Browse files
committed
NR-88357 readd finish listener for fastify support
1 parent 3900424 commit 0997b3d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/instrumentation/core/http.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function wrapEmitWithTransaction(agent, emit, isHTTPS) {
145145

146146
function instrumentedFinish() {
147147
// Remove listeners so this doesn't get called twice.
148+
response.removeListener('finish', instrumentedFinish)
148149
response.removeListener('close', instrumentedFinish)
149150

150151
// Naming must happen before the segment and transaction are ended,
@@ -186,6 +187,7 @@ function wrapEmitWithTransaction(agent, emit, isHTTPS) {
186187
segment.end()
187188
transaction.end()
188189
}
190+
response.once('finish', instrumentedFinish)
189191
response.once('close', instrumentedFinish)
190192

191193
return tracer.bindFunction(emit, segment).apply(this, arguments)

0 commit comments

Comments
 (0)