Skip to content
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

Add automatic instrumentation to @sentry/nestjs where @Injectable is not used #13517

Open
Tracked by #12504 ...
nicohrubec opened this issue Aug 29, 2024 · 2 comments
Open
Tracked by #12504 ...
Labels
Package: nestjs Issues related to the Sentry Nestjs SDK

Comments

@nicohrubec
Copy link
Contributor

nicohrubec commented Aug 29, 2024

Currently the following automatic instrumentations rely on users putting @Injectable on top of their implementations:

  • Middleware
  • Interceptors
  • Pipes
  • Guards

The problem with this approach is that, even though the nestjs docs say you need the decorator for these constructs, they work fine without if they do not rely on other dependencies being injected. ref Currently these would not get instrumented without the decorator and users would have to manual instrumentation.

Solution Brainstorm:
There is several other places we can monkey-patch to make this more robust.

  • core/nest-application.ts: contains API like app.useGlobalFilters, app.use, app.useInterceptors
  • other decorators that can be put directly on controllers and get implementations as input: @UseFilters, @Useinterceptors
@nicohrubec nicohrubec added Type: Improvement Package: nestjs Issues related to the Sentry Nestjs SDK labels Aug 29, 2024
@lforst
Copy link
Member

lforst commented Aug 29, 2024

There is several other places we can monkey-patch to make this more robust.

@nicohrubec Which ones do you have in mind?

@nicohrubec
Copy link
Contributor Author

@lforst still updating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nestjs Issues related to the Sentry Nestjs SDK
Projects
None yet
Development

No branches or pull requests

3 participants