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

Fix for incorrect metric causing high cardinality #192

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

sioked
Copy link
Contributor

@sioked sioked commented Mar 14, 2024

The isLoadedInFrame variable previously was isPayPalDomain() && window.xprops. Because of the && operator, the value here would be the value of window.xprops which is a very high cardinality value. We ended up having metrics disabled due to the cardinality of these events so casting to a Boolean should solve for that.

One thing I'm not clear on is why we're mapping isLoadedInFrame to isPayPalDomain and not calling isPayPalDomain() directly, but I'm only trying to solve the cardinality issue on this event.

@sioked sioked requested review from wsbrunson and jshawl March 14, 2024 20:19
@sioked sioked requested a review from a team as a code owner March 14, 2024 20:19
src/tracking.js Outdated
@@ -203,7 +188,7 @@ export function setupLogger() {
dimensions: {
components: getComponents().join(","),
integrationSource,
isPayPalDomain: isLoadedInFrame,
isPayPalDomain: Boolean(isLoadedInFrame),
Copy link
Contributor

@elizabethmv elizabethmv Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is still the case but we've seen in the past signalFX dropping boolean values. Should we make sure this is a true/false string or some other string value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation! I wasn't aware of that - I'll change this to a string

Copy link
Contributor

@jshawl jshawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change (after the lint fix) but wanted to propose an optional/additional change in beaver-logger around https://github.com/krakenjs/beaver-logger/blob/87749c48788dfd2525fb9b075ca33a7bf69d3311/src/logger.js#L296-L301

that limits the max cardinality value (truncate and console.warn maybe?)

@sioked sioked force-pushed the es-fix-for-edit-fi-flow branch from 63bfbe0 to b3d1ca0 Compare March 14, 2024 21:31
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 74.28%. Comparing base (6ce78b2) to head (b3d1ca0).
Report is 1 commits behind head on main.

Files Patch % Lines
src/tracking.js 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #192      +/-   ##
==========================================
+ Coverage   73.74%   74.28%   +0.54%     
==========================================
  Files          23       23              
  Lines        2045     2030      -15     
  Branches      241      239       -2     
==========================================
  Hits         1508     1508              
+ Misses        527      512      -15     
  Partials       10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sioked
Copy link
Contributor Author

sioked commented Mar 14, 2024

@jshawl I would love to find a way to validate/limit the cardinality in beaver logger. We could look at the length of the string as a possible indicator, but it is possible to have low cardinality across all of the metrics while also having a long string length. Do you have any thoughts or ideas?

@sioked sioked merged commit 7f5214b into paypal:main Mar 14, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants