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(spans): check sdk platform for user.geo.subregion tag #4023

Merged
merged 3 commits into from
Sep 11, 2024

Conversation

DominikB2014
Copy link
Contributor

@DominikB2014 DominikB2014 commented Sep 10, 2024

Work towards getsentry/sentry#75230
This is an extension of this PR #4013

I assumed that Backend SDK transactions would not have a browser context, so i used that as a means to check if the project is a frontend project. Turns out, python SDKs still set browser context on the transaction (I guess this is the browser the user made the request from?). So to fix this, we can just check the platform directly as frontend is typically/always javascript.

@DominikB2014 DominikB2014 requested a review from a team as a code owner September 10, 2024 16:34
CHANGELOG.md Outdated Show resolved Hide resolved
let should_extract_geo =
event.context::<BrowserContext>().is_some() || MOBILE_SDKS.contains(&event.sdk_name());
let should_extract_geo = (event.context::<BrowserContext>().is_some()
&& event.platform.as_str() == Some("javascript"))
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this still be a javascript backend client? Or is python the only backend SDK that sets browser context?

Copy link
Contributor Author

@DominikB2014 DominikB2014 Sep 11, 2024

Choose a reason for hiding this comment

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

@jjbayer Yes but this is not a super common case, because most javascript backends have platform set to "node" instead of javascript. This is a pretty easy change to add, so I think we can see how much of an improvement it makes before moving onto more improvements.

Co-authored-by: Joris Bayer <joris.bayer@sentry.io>
@DominikB2014 DominikB2014 merged commit b82aa67 into master Sep 11, 2024
23 checks passed
@DominikB2014 DominikB2014 deleted the DominikB2014/check-event-platform branch September 11, 2024 14:37
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.

2 participants