Closed parsasi closed 11 months ago
Thanks @parsasi, I'll check on that. I haven't noticed a big impact on performance using the proposed setup but obviously if it's easy to improve it we should definitely use an optimized solution.
Hi @parsasi , I did some load testing and the performance started to get consistently worse on pretty high load. I made a PR with your solution above. Thanks for that. Do you want to author the PR?
Btw I published the load testing scripts in the master
branch if you wanna try.
Hi @ericjeker, I'd love to author the PR. I'll have it in a couple of days. Thanks!
[UPDATE] I see you've already made it. I'll wait for future opportunities for contributions :)
Merged the PR.
Thank you for creating this. I just wanted to warn that using this will cause pretty much all dependencies to be Request Scoped. I'd recommend not using this approach in production.
The Problem
By making the providers request-scoped, and injecting them to AppModule, API will instantiate new injection models for everything. This can slow down the API significantly.
The Solution
Use the context from the
intercept
method of the Exception Filter to start the Sentry Transaction and set the span.Extract the request from the
SentryInterceptor
.Modify the
sentry.service
to accept the request as a parameter, and return the scope: