Skip to content

Commit cd8c5e0

Browse files
authored
Remove user.segment (getsentry#2726)
1 parent 04bcf91 commit cd8c5e0

3 files changed

Lines changed: 1 addition & 10 deletions

File tree

MIGRATION_GUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Removed support for the `install` method for custom integrations. Please use `setup_once` instead.
3434
- Removed `sentry_sdk.tracing.Span.new_span`. Use `sentry_sdk.tracing.Span.start_child` instead.
3535
- Removed `sentry_sdk.tracing.Transaction.new_span`. Use `sentry_sdk.tracing.Transaction.start_child` instead.
36+
- Removed support for `user.segment`. It was also removed from the trace header as well as from the dynamic sampling context.
3637

3738
## Deprecated
3839

sentry_sdk/tracing_utils.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,6 @@ def from_options(cls, scope):
395395
if options.get("traces_sample_rate"):
396396
sentry_items["sample_rate"] = options["traces_sample_rate"]
397397

398-
user = (scope and scope._user) or {}
399-
if user.get("segment"):
400-
sentry_items["user_segment"] = user["segment"]
401-
402398
return Baggage(sentry_items, third_party_items, mutable)
403399

404400
@classmethod
@@ -416,7 +412,6 @@ def populate_from_transaction(cls, transaction):
416412
return Baggage(sentry_items)
417413

418414
options = client.options or {}
419-
user = (hub.scope and hub.scope._user) or {}
420415

421416
sentry_items["trace_id"] = transaction.trace_id
422417

@@ -435,9 +430,6 @@ def populate_from_transaction(cls, transaction):
435430
):
436431
sentry_items["transaction"] = transaction.name
437432

438-
if user.get("segment"):
439-
sentry_items["user_segment"] = user["segment"]
440-
441433
if transaction.sample_rate is not None:
442434
sentry_items["sample_rate"] = str(transaction.sample_rate)
443435

tests/test_envelope.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def generate_transaction_item():
2424
"environment": "dogpark",
2525
"release": "off.leash.park",
2626
"public_key": "dogsarebadatkeepingsecrets",
27-
"user_segment": "bigs",
2827
"transaction": "/interactions/other-dogs/new-dog",
2928
},
3029
}
@@ -105,7 +104,6 @@ def test_envelope_headers(sentry_init, capture_envelopes, monkeypatch):
105104
"environment": "dogpark",
106105
"release": "off.leash.park",
107106
"public_key": "dogsarebadatkeepingsecrets",
108-
"user_segment": "bigs",
109107
"transaction": "/interactions/other-dogs/new-dog",
110108
},
111109
}

0 commit comments

Comments
 (0)