Skip to content

Commit b82aa67

Browse files
fix(spans): check sdk platform for user.geo.subregion tag (#4023)
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. --------- Co-authored-by: Joris Bayer <[email protected]>
1 parent 8c3c3c2 commit b82aa67

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
- Remove the OTEL spans endpoint in favor of Envelopes. ([#3973](https://github.com/getsentry/relay/pull/3973))
2828
- Remove the `generate-schema` tool. Relay no longer exposes JSON schema for the event protocol. Consult the Rust type documentation of the `relay-event-schema` crate instead. ([#3974](https://github.com/getsentry/relay/pull/3974))
2929
- Allow creation of `SqliteEnvelopeBuffer` from config, and load existing stacks from db on startup. ([#3967](https://github.com/getsentry/relay/pull/3967))
30-
- Only tag `user.geo.subregion` on frontend and mobile projects. ([#4013](https://github.com/getsentry/relay/pull/4013))
30+
- Only tag `user.geo.subregion` on frontend and mobile projects. ([#4013](https://github.com/getsentry/relay/pull/4013), [#4023](https://github.com/getsentry/relay/pull/4023))
3131

3232
## 24.8.0
3333

relay-event-normalization/src/normalize/span/tag_extraction.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ fn extract_shared_tags(event: &Event) -> BTreeMap<SpanTagKey, String> {
320320
}
321321

322322
// We only want this on frontend or mobile modules.
323-
let should_extract_geo =
324-
event.context::<BrowserContext>().is_some() || MOBILE_SDKS.contains(&event.sdk_name());
323+
let should_extract_geo = (event.context::<BrowserContext>().is_some()
324+
&& event.platform.as_str() == Some("javascript"))
325+
|| MOBILE_SDKS.contains(&event.sdk_name());
325326

326327
if should_extract_geo {
327328
if let Some(country_code) = user.geo.value().and_then(|geo| geo.country_code.value()) {
@@ -2745,6 +2746,9 @@ LIMIT 1
27452746
"trace": {
27462747
"trace_id": "ff62a8b040f340bda5d830223def1d81",
27472748
"span_id": "bd429c44b67a3eb4"
2749+
},
2750+
"browser": {
2751+
"name": "Chrome"
27482752
}
27492753
},
27502754
"user": {

0 commit comments

Comments
 (0)