Skip to content
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

Figure out a way to find gaps in our normalization #5852

Closed
lforst opened this issue Sep 29, 2022 · 2 comments
Closed

Figure out a way to find gaps in our normalization #5852

lforst opened this issue Sep 29, 2022 · 2 comments

Comments

@lforst
Copy link
Member

lforst commented Sep 29, 2022

Why

This came out of a discussion #5851 (comment) in a PR that tried to resolve this issue: #2809

We had/have a gap in our normalization process and merged #5851 which is actually a very drastic change for a problem that probably shouldn't exist in the first place. Instead of blanket normalizing everything, we should be very specific in what we normalize - for that however, we need to know where we're missing normalization. That PR is a temporary solution at best because of the performance penalty it introduces.

How

We evaluated different approaches on finding the normalization gap:

  • Capture an additional exception here with the circ-dep path and let users report back to us.
  • Set a specific field in extra and show a warning on the Sentry product to report back to us.
  • Set a specific field in the payload with the circ-dep path and log that field in relay.

Left for us to do is decide what to do and then implement it.

@timfish
Copy link
Collaborator

timfish commented Oct 5, 2022

It might be worth using structuredClone since this is native and is likely to be the fastest way to remove circular dependencies in modern browsers:

The structured clone algorithm copies complex JavaScript objects. It is used internally when invoking structuredClone(), to transfer data between Workers via postMessage(), storing objects with IndexedDB, or copying objects for other APIs.

It clones by recursing through the input object while maintaining a map of previously visited references, to avoid infinitely traversing cycles.

structuredClone throws when it encounters Functions and DOM nodes so they'd need to be stripped out first.

@timfish
Copy link
Collaborator

timfish commented Oct 5, 2022

Oh no ignore me 🤦🏻‍♂️

I've just read the docs again and the circular references are preserved in the output, it just ensures that circular references don't cause infinite traversing.

@HazAT HazAT closed this as completed Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants