Re-position CaptureExceptions middleware to reduce tracing noise #1405
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now,
sentry-rails
is smart enough to un-sample transactions of static file/assets requests.But users may still see tracing logs in those requests like:
This is because the current implementation un-samples those transactions after the initial sampling decision has been made.
The approach's downsides are:
FileHandler
class.The reason behind it is the order of middlewares:
As you can see, when starting the transaction, the SDK can't possibly know if the request is for static files unless
Sentry::CaptureExceptions
also knows how to check static file requests.Solution - Re-position the middleware
When
CaptureExceptions
is the first middleware, the benefits are:But there are also some downsides:
By re-positioning the middleware after
ActionDispatch::Executor
, we can avoid the downsides while still keeping most of the benefits. It also allows us to remove the patch onFileHandler
.