Skip to content

Commit d6e4136

Browse files
JoshFergeandrewshie-sentry
authored andcommitted
chore: upgrade sentry_sdk for logging fix (#91900)
upgrade the sentry python sdk so we get some fixes for logging functionality. https://sentry.slack.com/archives/C081M1KEQ0L/p1747042396547599?thread_ts=1746721086.279279&cid=C081M1KEQ0L
1 parent 48e0e6c commit d6e4136

File tree

21 files changed

+63
-63
lines changed

21 files changed

+63
-63
lines changed

requirements-base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ sentry-ophio>=1.1.3
7171
sentry-protos==0.2.0
7272
sentry-redis-tools>=0.5.0
7373
sentry-relay>=0.9.9
74-
sentry-sdk[http2]>=2.25.1
74+
sentry-sdk[http2]>=2.29.1
7575
slack-sdk>=3.27.2
7676
snuba-sdk>=3.0.43
7777
simplejson>=3.17.6

requirements-dev-frozen.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ sentry-ophio==1.1.3
192192
sentry-protos==0.2.0
193193
sentry-redis-tools==0.5.0
194194
sentry-relay==0.9.9
195-
sentry-sdk==2.27.0
195+
sentry-sdk==2.29.1
196196
sentry-usage-accountant==0.0.10
197197
simplejson==3.17.6
198198
six==1.16.0

requirements-frozen.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ sentry-ophio==1.1.3
130130
sentry-protos==0.2.0
131131
sentry-redis-tools==0.5.0
132132
sentry-relay==0.9.9
133-
sentry-sdk==2.27.0
133+
sentry-sdk==2.29.1
134134
sentry-usage-accountant==0.0.10
135135
simplejson==3.17.6
136136
six==1.16.0

src/sentry/api/bases/organization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from sentry.utils import auth
3838
from sentry.utils.hashlib import hash_values
3939
from sentry.utils.numbers import format_grouped_length
40-
from sentry.utils.sdk import bind_organization_context, set_measurement
40+
from sentry.utils.sdk import bind_organization_context, set_span_data
4141

4242

4343
class NoProjects(Exception):
@@ -566,7 +566,7 @@ def get_filter_params(
566566
len_projects = len(projects)
567567
sentry_sdk.set_tag("query.num_projects", len_projects)
568568
sentry_sdk.set_tag("query.num_projects.grouped", format_grouped_length(len_projects))
569-
set_measurement("query.num_projects", len_projects)
569+
set_span_data("query.num_projects", len_projects)
570570

571571
params: FilterParams = {
572572
"start": start,

src/sentry/api/endpoints/organization_event_details.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from datetime import datetime, timedelta
33
from typing import Any
44

5-
import sentry_sdk
65
from rest_framework.request import Request
76
from rest_framework.response import Response
87
from snuba_sdk import Column, Condition, Function, Op
@@ -23,6 +22,7 @@
2322
from sentry.snuba.dataset import Dataset
2423
from sentry.snuba.query_sources import QuerySource
2524
from sentry.snuba.referrer import Referrer
25+
from sentry.utils.sdk import set_span_data
2626

2727
VALID_AVERAGE_COLUMNS = {"span.self_time", "span.duration"}
2828

@@ -39,7 +39,7 @@ def add_comparison_to_event(event, average_columns, request: Request):
3939
group_to_span_map[group].append(span)
4040

4141
# Nothing to add comparisons to
42-
sentry_sdk.set_measurement("query.groups", len(group_to_span_map))
42+
set_span_data("query.groups", len(group_to_span_map))
4343
if len(group_to_span_map) == 0:
4444
return
4545

@@ -77,7 +77,7 @@ def add_comparison_to_event(event, average_columns, request: Request):
7777
),
7878
)
7979
)
80-
sentry_sdk.set_measurement("query.groups_found", len(result["data"]))
80+
set_span_data("query.groups_found", len(result["data"]))
8181
for row in result["data"]:
8282
group = row["span.group"]
8383
for span in group_to_span_map[group]:

src/sentry/api/endpoints/organization_events_trace.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from sentry.snuba.referrer import Referrer
3737
from sentry.utils.iterators import chunked
3838
from sentry.utils.numbers import base32_encode, format_grouped_length
39-
from sentry.utils.sdk import set_measurement
39+
from sentry.utils.sdk import set_span_data
4040
from sentry.utils.snuba import bulk_snuba_queries
4141
from sentry.utils.validators import INVALID_ID_DETAILS, is_event_id, is_span_id
4242

@@ -761,7 +761,7 @@ def build_span_query(trace_id: str, spans_params: SnubaParams, query_spans: list
761761
# Performance improvement, snuba's parser is extremely slow when we're sending thousands of
762762
# span_ids here, using a `splitByChar` means that snuba will not parse the giant list of spans
763763
span_minimum = options.get("performance.traces.span_query_minimum_spans")
764-
sentry_sdk.set_measurement("trace_view.spans.span_minimum", span_minimum)
764+
set_span_data("trace_view.spans.span_minimum", span_minimum)
765765
sentry_sdk.set_tag("trace_view.split_by_char.optimization", len(query_spans) > span_minimum)
766766
if len(query_spans) > span_minimum:
767767
# TODO: because we're not doing an IN on a list of literals, snuba will not optimize the query with the HexInt
@@ -813,14 +813,14 @@ def augment_transactions_with_spans(
813813
projects.add(error["project.id"])
814814
ts_params = find_timestamp_params(transactions)
815815
time_buffer = options.get("performance.traces.span_query_timebuffer_hours")
816-
sentry_sdk.set_measurement("trace_view.spans.time_buffer", time_buffer)
816+
set_span_data("trace_view.spans.time_buffer", time_buffer)
817817
if ts_params["min"]:
818818
params.start = ts_params["min"] - timedelta(hours=time_buffer)
819819
if ts_params["max"]:
820820
params.end = ts_params["max"] + timedelta(hours=time_buffer)
821821

822822
if ts_params["max"] and ts_params["min"]:
823-
sentry_sdk.set_measurement(
823+
set_span_data(
824824
"trace_view.trace_duration", (ts_params["max"] - ts_params["min"]).total_seconds()
825825
)
826826
sentry_sdk.set_tag("trace_view.missing_timestamp_constraints", False)
@@ -899,7 +899,7 @@ def augment_transactions_with_spans(
899899
total_chunks = 3
900900
else:
901901
total_chunks = 4
902-
sentry_sdk.set_measurement("trace_view.span_query.total_chunks", total_chunks)
902+
set_span_data("trace_view.span_query.total_chunks", total_chunks)
903903
chunks = chunked(list_spans, (len(list_spans) // total_chunks) + 1)
904904
queries = [build_span_query(trace_id, spans_params, chunk) for chunk in chunks]
905905
results = bulk_snuba_queries(
@@ -1046,15 +1046,16 @@ def record_analytics(
10461046
sentry_sdk.set_tag(
10471047
"trace_view.transactions.grouped", format_grouped_length(len_transactions)
10481048
)
1049-
set_measurement("trace_view.transactions", len_transactions)
1049+
set_span_data("trace_view.transactions", len_transactions)
1050+
10501051
projects: set[int] = set()
10511052
for transaction in transactions:
10521053
projects.add(transaction["project.id"])
10531054

10541055
len_projects = len(projects)
10551056
sentry_sdk.set_tag("trace_view.projects", len_projects)
10561057
sentry_sdk.set_tag("trace_view.projects.grouped", format_grouped_length(len_projects))
1057-
set_measurement("trace_view.projects", len_projects)
1058+
set_span_data("trace_view.projects", len_projects)
10581059

10591060
def get(self, request: Request, organization: Organization, trace_id: str) -> HttpResponse:
10601061
if not self.has_feature(organization, request):

src/sentry/api/endpoints/organization_profiling_functions.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from sentry.snuba.dataset import Dataset
2525
from sentry.snuba.referrer import Referrer
2626
from sentry.utils.dates import parse_stats_period, validate_interval
27-
from sentry.utils.sdk import set_measurement
27+
from sentry.utils.sdk import set_span_data
2828
from sentry.utils.snuba import bulk_snuba_queries
2929

3030
TOP_FUNCTIONS_LIMIT = 50
@@ -202,7 +202,7 @@ def get_trends_data(stats_data) -> list[BreakpointData]:
202202
trending_functions = get_trends_data(stats_data)
203203

204204
all_trending_functions_count = len(trending_functions)
205-
set_measurement("profiling.top_functions", all_trending_functions_count)
205+
set_span_data("profiling.top_functions", all_trending_functions_count)
206206

207207
# Profiling functions have a resolution of ~10ms. To increase the confidence
208208
# of the results, the caller can specify a min threshold for the trend difference.
@@ -215,9 +215,7 @@ def get_trends_data(stats_data) -> list[BreakpointData]:
215215
]
216216

217217
filtered_trending_functions_count = all_trending_functions_count - len(trending_functions)
218-
set_measurement(
219-
"profiling.top_functions.below_threshold", filtered_trending_functions_count
220-
)
218+
set_span_data("profiling.top_functions.below_threshold", filtered_trending_functions_count)
221219

222220
# Make sure to sort the results so that it's in order of largest change
223221
# to smallest change (ASC/DESC depends on the trend type)

src/sentry/api/endpoints/organization_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sentry.api.utils import clamp_date_range, handle_query_errors
1616
from sentry.snuba.dataset import Dataset
1717
from sentry.utils.numbers import format_grouped_length
18-
from sentry.utils.sdk import set_measurement
18+
from sentry.utils.sdk import set_span_data
1919

2020

2121
@region_silo_endpoint
@@ -83,6 +83,6 @@ def get(self, request: Request, organization) -> Response:
8383
format_grouped_length(len(results), [1, 10, 50, 100]),
8484
)
8585
sentry_sdk.set_tag("dataset_queried", dataset.value)
86-
set_measurement("custom_tags.count", len(results))
86+
set_span_data("custom_tags.count", len(results))
8787

8888
return Response(serialize(results, request.user))

src/sentry/api/endpoints/organization_traces.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from sentry.snuba.dataset import Dataset
5050
from sentry.snuba.referrer import Referrer
5151
from sentry.utils.numbers import clip
52-
from sentry.utils.sdk import set_measurement
52+
from sentry.utils.sdk import set_span_data
5353
from sentry.utils.snuba import bulk_snuba_queries_with_referrers
5454
from sentry.utils.snuba_rpc import get_traces_rpc
5555

@@ -1417,7 +1417,7 @@ def process_user_queries(
14171417
where, _ = resolve_conditions(user_query)
14181418
queries[user_query] = where
14191419

1420-
set_measurement("user_queries_count", len(queries))
1420+
set_span_data("user_queries_count", len(queries))
14211421
sentry_sdk.set_context("user_queries", {"raw_queries": user_queries})
14221422

14231423
return queries
@@ -1452,7 +1452,7 @@ def process_rpc_user_queries(
14521452
if where is not None:
14531453
queries[user_query] = where
14541454

1455-
set_measurement("user_queries_count", len(queries))
1455+
set_span_data("user_queries_count", len(queries))
14561456
sentry_sdk.set_context("user_queries", {"raw_queries": user_queries})
14571457

14581458
return queries

src/sentry/api/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from sentry.silo.base import SiloMode
4545
from sentry.types.region import get_local_region
4646
from sentry.utils.dates import parse_stats_period
47-
from sentry.utils.sdk import capture_exception, merge_context_into_scope
47+
from sentry.utils.sdk import capture_exception, merge_context_into_scope, set_span_data
4848
from sentry.utils.snuba import (
4949
DatasetSelectionError,
5050
QueryConnectionFailed,
@@ -454,7 +454,7 @@ def update_snuba_params_with_timestamp(
454454
# While possible, the majority of traces shouldn't take more than a week
455455
# Starting with 3d for now, but potentially something we can increase if this becomes a problem
456456
time_buffer = options.get("performance.traces.transaction_query_timebuffer_days")
457-
sentry_sdk.set_measurement("trace_view.transactions.time_buffer", time_buffer)
457+
set_span_data("trace_view.transactions.time_buffer", time_buffer)
458458
example_start = example_timestamp - timedelta(days=time_buffer)
459459
example_end = example_timestamp + timedelta(days=time_buffer)
460460
# If timestamp is being passed it should always overwrite the statsperiod or start & end

0 commit comments

Comments
 (0)