Skip to content

Commit fa5d0ba

Browse files
committed
keep old format (why not)
1 parent 70d02cc commit fa5d0ba

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

MIGRATION_GUIDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
1919
- Redis integration: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).
2020
- clickhouse-driver integration: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`).
2121
- `sentry_sdk.init` now returns `None` instead of a context manager.
22-
- The sampling context accessible in `traces_sampler` has changed. The original `sampling_context["transaction_context"]["name"]` and `sampling_context["transaction_context"]["op"]` are now accessible as `sampling_context["sentry_name"]` and `sampling_context["sentry_op"]`, respectively.
2322

2423
### Removed
2524

sentry_sdk/integrations/opentelemetry/consts.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@ class SentrySpanAttribute:
3030
NAME = "sentry.name"
3131
SOURCE = "sentry.source"
3232
CONTEXT = "sentry.context"
33-
CUSTOM_SAMPLED = "sentry.custom_sampled"
34-
PARENT_SAMPLED = "sentry.parent_sampled"

sentry_sdk/integrations/opentelemetry/sampler.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,14 @@ def should_sample(
129129
# Traces_sampler is responsible to check parent sampled to have full transactions.
130130
has_traces_sampler = callable(client.options.get("traces_sampler"))
131131
if has_traces_sampler:
132-
attributes[SentrySpanAttribute.PARENT_SAMPLED] = get_parent_sampled(
133-
parent_span_context, trace_id
134-
)
135-
sample_rate = client.options["traces_sampler"](attributes)
132+
sampling_context = {
133+
"transaction_context": {
134+
"name": name,
135+
"op": attributes.get("op"),
136+
},
137+
"parent_sampled": get_parent_sampled(parent_span_context, trace_id),
138+
}
139+
sample_rate = client.options["traces_sampler"](sampling_context)
136140

137141
else:
138142
# Check if there is a parent with a sampling decision

0 commit comments

Comments
 (0)