-
Notifications
You must be signed in to change notification settings - Fork 142
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
Report original error from addReactError
instead of fake rendering error
#3285
Report original error from addReactError
instead of fake rendering error
#3285
Conversation
bc51de5
to
62cf07d
Compare
@@ -137,7 +137,7 @@ export function createPreStartStrategy( | |||
bufferApiCalls.add((startRumResult) => startRumResult.addDurationVital(vital)) | |||
} | |||
|
|||
return { | |||
const strategy: Strategy = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: What about also passing the strategy
in onInit
hook instead of publicApi
. This would limit the number of concepts in the React Plugin. To be more explicit we could also rename it startRumStrategy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing the strategy in onInit
is not that useful because it would be the preStartStrategy
and there is a good chance that it won't be used right after the hook is called. I think it would make things more complex/confusing for little benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in addition to what benoit said, the preStartStrategy
buffer has already been flushed by the time onInit
is called, which means that any usage of it would be completely ignored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eloytoro and I briefly discussed exposing the lifeCycle
instead of the strategy
, which might make things more flexible, but for now strategy
seems simpler/enough. We can revisit later.
/merge |
Devflow running:
|
Closing this in favour of #3293 because the CI does not like PRs across forks |
Motivation
The ErrorBoundary component will capture whatever error occurs inside of it and send it to datadog, when this happens it renders the fallback component supplied to it. This works similar to a try/catch, where errors that occur within a component tree will not cause the entire application to crash and instead show a fallback.
As of today there’s a big problem with how ErrorBoundary reports these errors to datadog and how that plays into the Error Tracking product.
The original thrown error is not the one being reported, instead a different error is with a different stack trace (the one obtained from react’s error info) and a different error name (or @error.type in datadog). This messes with Error Tracking’s grouping.
This is the anatomy of a react error sent to Datadog today:
It would make more sense to report the original error so it has the original stack and name, drop the cause since it wouldn’t be needed anymore and add the the component’s stack as an additional
component_stack
property reported to datadog.Changes
In order to achieve this it's necessary to expose the
strategy
object through a new hook in plugins namedonRumStart
. Now additional information can be added to the payload outside of the event'scontext
Only after that the
strategy
object is accessed by the react plugin and used inaddReactError
to send the component's stackTesting
Unit tests were added