Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 30, 2026

Previously, our applySdkMetadata helper in core would only apply default SDK metadata (name, packages, version) if no sdk data at all was set. This caused incomplete SDK metadata when manually overriding sdk.settings (see #19072).

This PR now ensures that only if the name is already set, we don't apply our default options. This should be fine-grained enough to still have correct SDK metadata inheritance. I also added a bunch of tests, since applySdkMetadata had no unit tests.

To be clear, I don't think we should promote controlling IP inference via SDK metadata. However, for now, it's the only way to control IP inference in a fine-grained manner, as opposed to setting sendDefaultPii. The long-term solution is a more fine grained Pii SDK option as we're already planning to do. I think that the metadata application now is more correct though, since this also allows other SDKs to override such settings should they need to.

closes #19072

@Lms24 Lms24 marked this pull request as ready for review January 30, 2026 09:51
@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

Codecov Results 📊


Generated by Codecov Action

@Lms24 Lms24 requested review from logaretm and s1gr1d January 30, 2026 09:52
@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.41 kB +0.06% +13 B 🔺
@sentry/browser - with treeshaking flags 23.87 kB +0.07% +15 B 🔺
@sentry/browser (incl. Tracing) 42.22 kB +0.02% +8 B 🔺
@sentry/browser (incl. Tracing, Profiling) 46.86 kB +0.03% +10 B 🔺
@sentry/browser (incl. Tracing, Replay) 80.84 kB +0.02% +11 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.45 kB +0.02% +13 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 85.55 kB +0.02% +11 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 97.74 kB +0.02% +12 B 🔺
@sentry/browser (incl. Feedback) 42.13 kB +0.03% +11 B 🔺
@sentry/browser (incl. sendFeedback) 30.09 kB +0.03% +7 B 🔺
@sentry/browser (incl. FeedbackAsync) 35.09 kB +0.04% +12 B 🔺
@sentry/browser (incl. Metrics) 26.51 kB +0.05% +12 B 🔺
@sentry/browser (incl. Logs) 26.67 kB +0.04% +10 B 🔺
@sentry/browser (incl. Metrics & Logs) 27.33 kB +0.05% +12 B 🔺
@sentry/react 27.14 kB +0.05% +11 B 🔺
@sentry/react (incl. Tracing) 44.46 kB +0.03% +9 B 🔺
@sentry/vue 29.84 kB +0.05% +13 B 🔺
@sentry/vue (incl. Tracing) 44.02 kB +0.03% +13 B 🔺
@sentry/svelte 25.43 kB +0.06% +13 B 🔺
CDN Bundle 27.95 kB +0.03% +8 B 🔺
CDN Bundle (incl. Tracing) 42.99 kB +0.04% +13 B 🔺
CDN Bundle (incl. Logs, Metrics) 28.79 kB +0.04% +10 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 43.81 kB +0.03% +12 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 67.74 kB +0.02% +12 B 🔺
CDN Bundle (incl. Tracing, Replay) 79.72 kB +0.02% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 80.59 kB +0.02% +12 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 85.16 kB +0.01% +5 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.09 kB +0.01% +4 B 🔺
CDN Bundle - uncompressed 81.75 kB +0.03% +23 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 127.29 kB +0.02% +23 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 84.59 kB +0.03% +23 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.13 kB +0.02% +23 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 207.97 kB +0.02% +23 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 243.9 kB +0.01% +23 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 246.72 kB +0.01% +23 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 256.69 kB +0.01% +23 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 259.5 kB +0.01% +23 B 🔺
@sentry/nextjs (client) 46.8 kB +0.02% +6 B 🔺
@sentry/sveltekit (client) 42.59 kB +0.03% +11 B 🔺
@sentry/node-core 52.15 kB +0.01% +5 B 🔺
@sentry/node 166.16 kB +0.01% +6 B 🔺
@sentry/node - without tracing 93.92 kB +0.02% +11 B 🔺
@sentry/aws-serverless 109.44 kB +0.02% +11 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,302 - 8,842 +5%
GET With Sentry 1,719 18% 1,673 +3%
GET With Sentry (error only) 6,205 67% 5,638 +10%
POST Baseline 1,210 - 1,077 +12%
POST With Sentry 589 49% 527 +12%
POST With Sentry (error only) 1,070 88% 1,016 +5%
MYSQL Baseline 3,373 - 3,199 +5%
MYSQL With Sentry 456 14% 394 +16%
MYSQL With Sentry (error only) 2,763 82% 2,617 +6%

View base workflow run

};
}

if (!metadata.sdk) {
Copy link
Member

Choose a reason for hiding this comment

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

I might be missing something but isn't this doing the same check as line 20? if so metadata.sdk will always be set before it hits this line here, no?

https://github.com/getsentry/sentry-javascript/blob/develop/packages/core/src/utils/sdkMetadata.ts#L20-L29

Copy link
Member Author

@Lms24 Lms24 Jan 30, 2026

Choose a reason for hiding this comment

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

Yeah not sure why but I had a massive brain outage on this one: I added my new logic underneath the old one and forgot to delete the old one afterwards. 🤦

Found a way to make this all a bit more concise. Might even save us some bytes. 🤞 Thanks for calling this out!

@Lms24 Lms24 self-assigned this Jan 30, 2026
Copy link
Member

@logaretm logaretm left a comment

Choose a reason for hiding this comment

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

Fridays be like that, nice one!

@Lms24 Lms24 enabled auto-merge (squash) January 30, 2026 17:54
@Lms24 Lms24 merged commit c104764 into develop Jan 30, 2026
421 of 424 checks passed
@Lms24 Lms24 deleted the lms/fix-core-applySdkMetadata-partial-merge branch January 30, 2026 18:00
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.

Allow enabling infer_ip without enabling all default PII

3 participants