getsentry / getsentry/sentry-javascript

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

Offen
#13,517 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Improvement Nest.js
Vorherrschende Sprache
TypeScript
Sterne
8.7k
Forks
1.8k
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
515

Beschreibung

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`

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.