-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nestjs): Automatic instrumentation of nestjs interceptors before route execution #13153
Conversation
size-limit report 📦
|
|
||
const transactionEvent = await pageloadTransactionEventPromise; | ||
|
||
console.log(transactionEvent.spans); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(transactionEvent.spans); |
|
||
const transactionEvent = await pageloadTransactionEventPromise; | ||
|
||
console.log(transactionEvent.spans); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(transactionEvent.spans); |
@@ -32,6 +32,8 @@ import type { Observable } from 'rxjs'; | |||
* Interceptor to add Sentry tracing capabilities to Nest.js applications. | |||
*/ | |||
class SentryTracingInterceptor implements NestInterceptor { | |||
public static readonly __SENTRY_INTERNAL__ = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: maybe add a comment for this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Adds automatic instrumentation of interceptors to
@sentry/nestjs
. Interceptors in nest have a@Injectable
decorator and implement aintercept
function. So we can simply extend the existing instrumentation to add a proxy forintercept
.Current screenshot from my sample app:

Remark: Interceptors allow users to add functionality before and after a route handler is called. This PR adds tracing to whatever happens before the route is executed. I am still figuring out how to trace any instructions after the route was executed. Will do that in a separate PR.