-
-
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(utils): Limit normalize
maximum properties/elements
#4689
feat(utils): Limit normalize
maximum properties/elements
#4689
Conversation
55d1c10
to
96b9ce5
Compare
normalize
maximum properties/elementsnormalize
maximum properties/elements
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.
I left a few language edits on the current implementation, but I have a more fundamental question.
I get why to limit the breadth of any given object/array, but why do we have to move walk
inside of normalize
to do it? That feels like a change which a) should happen in a separate PR if it happens, and b) makes the code harder to read and which I'd therefore try to talk you out of. 😛
Yep, completely unnecessary and copied from the previous PR where it made more sense! |
Co-authored-by: Katie Byers <lobsterkatie@gmail.com>
c30f40b
to
48fc389
Compare
I moved Need to do a docs PR to add this option. |
Nice. 🙂 This looks good! My only other question is naming. Given that objects have properties but arrays have elements, and this applies to both, what would you think of something more generic like |
I've changed it to |
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.
LGTM!
@timfish - Not sure if you have merge permissions, so I'm going to go ahead and pull this in. LMK if that's something you can do, and if so, I'll leave it for you in future. |
I don't have merge permissions. Merge away! |
normalize
maximum properties/elementsnormalize
maximum properties/elements
This documents the new `normalizeMaxBreadth` option added to JS-based SDKs in getsentry/sentry-javascript#4689, which controls how many properties or entries any given object or array will contain after normalization.
Limits number of properties/elements serialised for an object/array. An improvement over #4687 because it doesn't bail out of normalisation when the limit is reached.
This protects against huge objects being serialised if users inadvertently log huge objects.
I chose a limit of 1000 properties/elements. If this is deemed too low for a minor release, we could increase this and reduce it again for v7?
NOTE
This adds
normalizeMaxBreadth
toinit
options (documented in getsentry/sentry-docs#4844)Ref: https://getsentry.atlassian.net/browse/WEB-711