-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(browser): Extract and send frontend component name when available #9855
Conversation
…crumbs separately
size-limit report 📦
|
*/ | ||
export function getComponentName(elem: unknown): string | null { | ||
let currentElem = elem as SimpleNode; | ||
const MAX_TRAVERSE_HEIGHT = 5; |
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.
5 might be a bit too high, but I'm unsure. We could lower this threshold to start out and gradually increase it if necessary, or keep it at 5
Could we split this PR up?
|
} catch (e) { | ||
target = '<unknown>'; | ||
componentName = null; |
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.
This line is unnecessary
One of the PRs scoped from #9855 Sends component names on the databag of interaction spans
One of the PRs scoped from #9855 Sends component names on Replay UI breadcrumbs so they can be ingested and indexed. This will allow for searching for Replays by component name in the future. --------- Co-authored-by: Yagiz Nizipli <[email protected]>
One of the PRs scoped from #9855 Sends component names on UI event breadcrumbs --------- Co-authored-by: Abhijeet Prasad <[email protected]>
Iterates on #9496
This is similar to the previous linked PR, but addresses some issues / concerns that were encountered when experimenting with it. Here's what's new this time around:
data-sentry-component
attribute instead ofdata-component
_htmlElementAsString
to check if thedata-sentry-component
attribute is present on the DOM and use it. This way,htmlTreeAsString
will include the React component when building the string. Example:body > div > MyTestComponent
getComponentName
to find a representative component for a DOM element. It will traverse up the tree up to a max of 5 ancestors to find a component name, as it is possible that the event is captured on a nested element instead of the component itselfcomponentName
to thedata
attribute for DOM breadcrumbs, instead of replacing the string in themessage
ui.component_name
to thedata
attribute in interaction and React spansdata-sentry-component
todata.node.attributes
on Replay UI breadcrumbs