-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
issue
It happens because of event finish order.
In handler:
https://github.com/getsentry/sentry-javascript/blob/master/packages/node/src/handlers.ts#L65
In express
https://github.com/getsentry/sentry-javascript/blob/master/packages/tracing/src/integrations/express.ts#L121
The handlers listener fires before express, as result the last spin has been filtered in:
https://github.com/getsentry/sentry-javascript/blob/master/packages/tracing/src/transaction.ts#L90
because the last span still doesn't have the endTimestamp
2 options to fix this issue:
- use
closelistener instead offinishinhandlers.ts. Thecloseevent runs afterfinish.
res.once('close', () => {
transaction.setHttpStatus(res.statusCode);
transaction.finish();
});- finish all spans if
transaction.finish();runs
const finishedSpans = this.spanRecorder ? this.spanRecorder.spans
.reduce((spans, s) => {
!s.endTimestamp && s.finish();
s !== this && spans.push(s);
return spans;
}, []) : [];Let me know which option is best for you.
Metadata
Metadata
Assignees
Labels
No labels