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

feat(browser): Set user.ip_address explicitly to {{auto}} #15008

Merged
merged 6 commits into from
Jan 20, 2025

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 14, 2025

Part of getsentry/team-sdks#118

This is so far inferred at relay-side, which is pretty intransparent and potentially confusing.
So instead, we want to explicitly set this in the SDK. If this is set to null it will not be inferred (which is kind of intransparent too, but...)

This is set for:

  • error events (as user.ip_address)
  • transactions (as user.ip_address)
  • replay events (as user.ip_address)
  • profiles (as user.ip_address)
  • sessions (as user.ip_address)
  • session aggregates: as attr.ip_address: '{{auto}}'
  • standalone spans (not by default, but added to all standalone web vitals spans we emit, as 'client.address': '{{auto}}' attribute)

Copy link
Contributor

github-actions bot commented Jan 14, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.98 KB +0.51% +119 B 🔺
@sentry/browser - with treeshaking flags 21.64 KB +0.46% +101 B 🔺
@sentry/browser (incl. Tracing) 35.68 KB +0.33% +120 B 🔺
@sentry/browser (incl. Tracing, Replay) 72.48 KB +0.15% +108 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.99 KB +0.2% +126 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 76.73 KB +0.13% +101 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 88.74 KB +0.13% +112 B 🔺
@sentry/browser (incl. Feedback) 39.2 KB +0.27% +107 B 🔺
@sentry/browser (incl. sendFeedback) 27.61 KB +0.38% +105 B 🔺
@sentry/browser (incl. FeedbackAsync) 32.37 KB +0.3% +98 B 🔺
@sentry/react 25.66 KB +0.36% +94 B 🔺
@sentry/react (incl. Tracing) 38.46 KB +0.26% +101 B 🔺
@sentry/vue 27.04 KB +0.33% +91 B 🔺
@sentry/vue (incl. Tracing) 37.45 KB +0.35% +133 B 🔺
@sentry/svelte 23.11 KB +0.48% +111 B 🔺
CDN Bundle 24.37 KB +0.37% +91 B 🔺
CDN Bundle (incl. Tracing) 36 KB +0.27% +96 B 🔺
CDN Bundle (incl. Tracing, Replay) 70.65 KB +0.15% +108 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 75.79 KB +0.15% +116 B 🔺
CDN Bundle - uncompressed 71.17 KB +0.47% +339 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 106.82 KB +0.34% +367 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 217.67 KB +0.18% +398 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 230.21 KB +0.17% +398 B 🔺
@sentry/nextjs (client) 38.59 KB +0.29% +113 B 🔺
@sentry/sveltekit (client) 36.22 KB +0.3% +110 B 🔺
@sentry/node 161.37 KB +0.02% +19 B 🔺
@sentry/node - without tracing 97.15 KB +0.02% +16 B 🔺
@sentry/aws-serverless 127.04 KB +0.01% +13 B 🔺

View base workflow run

Copy link

codecov bot commented Jan 14, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
689 1 688 299
View the full list of 1 ❄️ flaky tests
request-instrumentation.test.ts Should send a transaction with a fetch span

Flake rate in main: 40.00% (Passed 6 times, Failed 4 times)

Stack Traces | 30s run time
request-instrumentation.test.ts:4:5 Should send a transaction with a fetch span

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@krystofwoldrich
Copy link
Member

Why do we implement this only in browser client and not in the core/baseClient?

@timfish
Copy link
Collaborator

timfish commented Jan 14, 2025

Why do we implement this only in browser client and not in the core/baseClient?

Yep, good point. I just added this to Electron which would be unnecessary if this was added to core.

I think we don't want this in the Node client (or other server clients) because it would mean all events end up with the server IP address?

This PR is missing the sendDefaultPii check!

@mydea mydea force-pushed the fn/set-user-ip-browser branch from 8670611 to fb62082 Compare January 15, 2025 08:48
@mydea
Copy link
Member Author

mydea commented Jan 15, 2025

The idea behind adding this to browser client directly is because we def. do not want this for server side clients, so IMHO it should not live in core 🤔

Regarding the sendDefaultPii, for now I opted to leave the behavior the same as it was. In a follow up, we can decide if we want to change the default!

@mydea mydea force-pushed the fn/set-user-ip-browser branch from 522d43a to b34541a Compare January 15, 2025 14:08
@mydea
Copy link
Member Author

mydea commented Jan 16, 2025

@krystofwoldrich & @timfish I ended up rewriting this a bit to use hooks instead of hard-coding this too much into the browser SDK. This means that electron/RN should be able to just copy the hook config from the browser SDK to get the same/consistent behavior!

Copy link
Collaborator

@timfish timfish left a comment

Choose a reason for hiding this comment

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

We should open an issue to track sendDefaultPii because currently if you set sendDefaultPii: false it will still result in an IP address being included and it might get forgotten!

@mydea
Copy link
Member Author

mydea commented Jan 20, 2025

We should open an issue to track sendDefaultPii because currently if you set sendDefaultPii: false it will still result in an IP address being included and it might get forgotten!

There is already this issue: #5347

@mydea mydea force-pushed the fn/set-user-ip-browser branch from b54f4c2 to a8293ad Compare January 20, 2025 11:05
@mydea mydea merged commit eedf4a5 into develop Jan 20, 2025
169 checks passed
@mydea mydea deleted the fn/set-user-ip-browser branch January 20, 2025 12:28
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.

4 participants