Skip to content

feat(nestjs): Update scope transaction name with parameterized route#11510

Merged
Lms24 merged 3 commits intodevelopfrom
lms/feat-nestjs-update-scope-transactionName
Apr 9, 2024
Merged

feat(nestjs): Update scope transaction name with parameterized route#11510
Lms24 merged 3 commits intodevelopfrom
lms/feat-nestjs-update-scope-transactionName

Conversation

@Lms24
Copy link
Copy Markdown
Member

@Lms24 Lms24 commented Apr 9, 2024

This PR adds scope transactionName updating to our NestJS instrumentation. Similarly to Hapi and Fastify, we can use a framework-native component, an Interceptor, to assign the parameterized route.

The interesting part is that adding the interceptor almost wouldn't have been necessary: NestJS is built on top of express and apparently also allows to swap out express with Fastify or other frameworks. This causes our/Otel's express instrumentation to be initialized on app startup, already giving us a parameterized route via the express layer.

However, there's the use case of users disabling the express integration in which case I'd argue, the NestJS integration should still set the transactionName. Also, double-setting the name doesn't matter either so we're good.

ref #10846

@Lms24 Lms24 self-assigned this Apr 9, 2024
@Lms24 Lms24 merged commit 0896e4f into develop Apr 9, 2024
@Lms24 Lms24 deleted the lms/feat-nestjs-update-scope-transactionName branch April 9, 2024 15:32
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
…etsentry#11510)

This PR adds scope transactionName updating to our NestJS
instrumentation. Similarly to Hapi and Fastify, we can use a
framework-native component, an Interceptor, to assign the parameterized
route.

ref getsentry#10846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants