Skip to content

Commit 2a6512c

Browse files
authored
chore: bump sentry-sdk 2.35.0 (#7357)
okay so I had to add a fix (getsentry/sentry-python#4688) to the earlier change (getsentry/sentry-python#4598) I made in the sentry-python sdk. so now I'm bumping the sentry-sdk to `2.35.0` to grab that fix. I added the `update_current_span ` convenience funtion that was also in this release getsentry/sentry-python#4673 **testing:** going to test this out in S4S first before moving on to de and us
1 parent 31903fd commit 2a6512c

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sentry-kafka-schemas==2.0.4
2525
sentry-protos==0.3.3
2626
sentry-redis-tools==0.5.0
2727
sentry-relay==0.9.5
28-
sentry-sdk==2.33.2
28+
sentry-sdk==2.35.0
2929
simplejson==3.17.6
3030
snuba-sdk==3.0.39
3131
structlog==22.3.0

snuba/web/db_query.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,12 @@ def execute_query_with_readthrough_caching(
293293
query_id: str,
294294
referrer: str,
295295
) -> Result:
296-
span = sentry_sdk.get_current_span()
297-
298296
if referrer in settings.BYPASS_CACHE_REFERRERS and state.get_config(
299297
"enable_bypass_cache_referrers"
300298
):
301299
query_id = f"randomized-{uuid.uuid4().hex}"
302300
clickhouse_query_settings["query_id"] = query_id
303-
if span:
304-
span.set_data("query_id", query_id)
301+
sentry_sdk.update_current_span(attributes={"query_id": query_id})
305302
return execute_query(
306303
clickhouse_query,
307304
query_settings,
@@ -315,8 +312,7 @@ def execute_query_with_readthrough_caching(
315312

316313
clickhouse_query_settings["query_id"] = f"randomized-{uuid.uuid4().hex}"
317314

318-
if span:
319-
span.set_data("query_id", query_id)
315+
sentry_sdk.update_current_span(attributes={"query_id": query_id})
320316

321317
def record_cache_hit_type(hit_type: int) -> None:
322318
span_tag = "cache_miss"
@@ -329,8 +325,7 @@ def record_cache_hit_type(hit_type: int) -> None:
329325
elif hit_type == SIMPLE_READTHROUGH:
330326
stats["cache_hit_simple"] = 1
331327
sentry_sdk.set_tag("cache_status", span_tag)
332-
if span:
333-
span.set_data("cache_status", span_tag)
328+
sentry_sdk.update_current_span(attributes={"cache_status": span_tag})
334329

335330
cache_partition = _get_cache_partition(reader)
336331
metrics.increment(

snuba/web/rpc/storage_routing/routing_strategies/outcomes_based.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ def _get_min_timerange_to_query_outcomes(self) -> int:
152152
)
153153

154154
def _get_routing_decision(self, routing_context: RoutingContext) -> RoutingDecision:
155-
span = sentry_sdk.get_current_span()
156155
routing_decision = RoutingDecision(
157156
routing_context=routing_context,
158157
strategy=self,
@@ -161,15 +160,15 @@ def _get_routing_decision(self, routing_context: RoutingContext) -> RoutingDecis
161160
can_run=True,
162161
)
163162
in_msg_meta = extract_message_meta(routing_decision.routing_context.in_msg)
164-
if span:
165-
span.set_data(
166-
"downsampling_mode",
167-
(
163+
sentry_sdk.update_current_span(
164+
attributes={
165+
"downsampling_mode": (
168166
"highest_accuracy"
169167
if self._is_highest_accuracy_mode(in_msg_meta)
170168
else "normal"
171169
),
172-
)
170+
}
171+
)
173172
if self._is_highest_accuracy_mode(in_msg_meta) or (
174173
# unspecified item type will be assumed as spans when querying
175174
# for GetTraces, there is no type specified so we assume spans because
@@ -216,11 +215,12 @@ def _get_routing_decision(self, routing_context: RoutingContext) -> RoutingDecis
216215
elif ingested_items > max_items_before_downsampling * 100:
217216
routing_decision.tier = Tier.TIER_512
218217

219-
if span:
220-
span.set_data("ingested_items", ingested_items)
221-
span.set_data(
222-
"max_items_before_downsampling", max_items_before_downsampling
223-
)
224-
span.set_data("tier", routing_decision.tier.name)
218+
sentry_sdk.update_current_span(
219+
attributes={
220+
"ingested_items": ingested_items,
221+
"max_items_before_downsampling": max_items_before_downsampling,
222+
"tier": routing_decision.tier.name,
223+
}
224+
)
225225

226226
return routing_decision

snuba/web/rpc/storage_routing/routing_strategies/storage_routing.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,12 @@ def _record_value_in_span_and_DD(
252252
) -> None:
253253
name = _SAMPLING_IN_STORAGE_PREFIX + name
254254
metrics_backend_func(name, value, tags, None)
255-
span = sentry_sdk.get_current_span()
256255
routing_context.extra_info[name] = {
257256
"type": metrics_backend_func.__name__,
258257
"value": value,
259258
"tags": tags,
260259
}
261-
if span is not None:
262-
span.set_data(name, value)
260+
sentry_sdk.update_current_span(attributes={name: value})
263261

264262
def _get_routing_decision(self, routing_context: RoutingContext) -> RoutingDecision:
265263
raise NotImplementedError

0 commit comments

Comments
 (0)