Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
f5010ee
Update requirements
antonpirker May 20, 2025
109670e
Remove propagate_hub because it is not needed because its the default…
antonpirker May 21, 2025
d1c81fb
Removed metrics_noop because there are no metrics anymore and thus no…
antonpirker May 21, 2025
4cbadbc
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 21, 2025
2a204f4
Make tests run locally until pytest-sentry is 3.0 compatible
antonpirker May 21, 2025
f3d56a1
Replace .set_data with .set_attribute
antonpirker May 21, 2025
fcc75ac
changed add_attachment
antonpirker May 21, 2025
b75ec43
Changed start_transaction to start_span and custom_sampling_context t…
antonpirker May 21, 2025
420b0e8
Changed continue_trace to use context manager
antonpirker May 21, 2025
4896797
Removed set_measurements helper function because it is not used in co…
antonpirker May 21, 2025
47401ba
oops
antonpirker May 21, 2025
ea9f446
marked places where dict-attributes are
antonpirker May 21, 2025
58062aa
Replaced with
antonpirker May 21, 2025
9ac4468
one more comment
antonpirker May 21, 2025
20c7098
more comments
antonpirker May 21, 2025
ee2cd8e
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 21, 2025
5d23052
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 21, 2025
e8212a0
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 23, 2025
22bfae5
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 23, 2025
d72b7c3
bump pytest-sentry
antonpirker May 23, 2025
cbc0ab5
:snowflake: re-freeze requirements
getsantry[bot] May 23, 2025
6a67a42
trigger ci
antonpirker May 23, 2025
6be5d4f
update pytest-sentry
antonpirker May 23, 2025
fbb5794
Replaced .transaction with .root_span
antonpirker May 23, 2025
262d7ec
Always use top level api to get scope
antonpirker May 23, 2025
bb55c2c
use sample_rate in attributes instead of custom_sampling_context
antonpirker May 26, 2025
767ff19
trigger ci
antonpirker May 26, 2025
d0713ae
Replaced .containing_transaction with .root_span
antonpirker May 26, 2025
539ba80
Removed unused option
antonpirker May 26, 2025
77db522
set num_of_spanes in event.data not event.measurement
antonpirker May 26, 2025
8ac865c
fixed linting
antonpirker May 26, 2025
c9aed13
Ignore measurements mypy check (because measuerements have already be…
antonpirker May 26, 2025
2f87727
replaced with
antonpirker May 26, 2025
eda30c8
formatting
antonpirker May 26, 2025
8d34740
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 27, 2025
2fc5724
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 27, 2025
9bdc5c7
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker May 28, 2025
811295a
does this work?
antonpirker May 28, 2025
3196756
restart ci
antonpirker May 28, 2025
6fe96cd
Updated assert
antonpirker May 28, 2025
cba2d08
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 2, 2025
b257ce3
trigger ci
antonpirker Jun 2, 2025
3d22514
Renamed set_span_data to set_span_attribute to reflect new api
antonpirker Jun 2, 2025
6fb01f0
Reverted attribute name change. this is safer
antonpirker Jun 2, 2025
ca31b3e
testing something
antonpirker Jun 2, 2025
b07b506
testing something
antonpirker Jun 2, 2025
7645de6
test
antonpirker Jun 2, 2025
19a8e15
trigger ci
antonpirker Jun 2, 2025
585ce09
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 3, 2025
6140c91
cleanup
antonpirker Jun 3, 2025
d74d1da
test: Remove redundant assertions
szokeasaurusrex Jun 4, 2025
021988d
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
szokeasaurusrex Jun 4, 2025
3e9cf51
Merge branch 'szokeasaurusrex/remove-redundant-assertion' into antonp…
szokeasaurusrex Jun 4, 2025
791fa5d
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 5, 2025
a6aaf63
Those set_attribute calls are fine. See https://github.com/getsentry/…
antonpirker Jun 5, 2025
e484188
ref: Use `set_client` to change DSN
szokeasaurusrex Jun 5, 2025
9188a3d
ref: Rename `set_span_data` to `set_span_attribute`
szokeasaurusrex Jun 5, 2025
2fe7a0c
Merge branch 'szokeasaurusrex/set_span_attribute' into antonpirker/co…
szokeasaurusrex Jun 5, 2025
ebec05e
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 6, 2025
f23fe52
Merge branch 'antonpirker/code-changes-for-sdk-3.0.0' of https://gith…
antonpirker Jun 6, 2025
b28a307
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 6, 2025
0870caa
ref: Remove `propagate_hub` to `ThreadingIntegration`
szokeasaurusrex Jun 6, 2025
102cb52
ref(sdk): Use top-level `get_current_scope`
szokeasaurusrex Jun 6, 2025
4c154c8
ref(sdk): Migrate to `get_isolation_scope`
szokeasaurusrex Jun 6, 2025
534c9e2
ref(sdk): Migrate to `sentry_sdk.get_global_scope`
szokeasaurusrex Jun 6, 2025
a71823e
:hammer_and_wrench: apply pre-commit fixes
getsantry[bot] Jun 6, 2025
3f1501e
Merge branch 'szokeasaurusrex/get_global_scope' into antonpirker/code…
szokeasaurusrex Jun 6, 2025
6fd66b1
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 11, 2025
7ef89f3
Merge branch 'antonpirker/code-changes-for-sdk-3.0.0' of https://gith…
antonpirker Jun 11, 2025
5d1e332
Removed debug code
antonpirker Jun 11, 2025
f1fc98b
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 11, 2025
443f074
test: Add test for custom sample rates (#93011)
szokeasaurusrex Jun 11, 2025
83eaa41
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 11, 2025
3f14f20
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 12, 2025
d494df2
set_data -> set_attribute
antonpirker Jun 12, 2025
3b850fd
trigger ci
antonpirker Jun 12, 2025
1e2e2ef
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 16, 2025
2193459
new pytest-sentry
antonpirker Jun 16, 2025
f641055
update
antonpirker Jun 16, 2025
0247622
client is not an argument of Scope constructor anymore
antonpirker Jun 16, 2025
e0c3e66
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 17, 2025
0522d95
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 17, 2025
25712df
Migrate sampling_context to use SDK 3.0 attributes (#94022)
sentrivana Jun 23, 2025
8858bc7
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 25, 2025
7b1245f
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 25, 2025
c1f35b4
naming
antonpirker Jun 26, 2025
b64c9ca
test parametrization
antonpirker Jun 26, 2025
f084069
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 26, 2025
aee5352
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 27, 2025
3674af7
Removed new tests to test something
antonpirker Jun 27, 2025
6c2a99f
small fix
antonpirker Jun 27, 2025
5411f36
Revert "Removed new tests to test something"
antonpirker Jun 27, 2025
2804ca9
better checks
antonpirker Jun 27, 2025
cc789a0
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
antonpirker Jun 27, 2025
357dfec
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
sentrivana Jun 30, 2025
4f0cec6
Fix scope level calls
sl0thentr0py Jul 1, 2025
4eba442
Merge remote-tracking branch 'origin/master' into antonpirker/code-ch…
sl0thentr0py Jul 1, 2025
7c2038d
Bump pytest-sentry to 0.5.1
sl0thentr0py Jul 1, 2025
bc22138
Merge branch 'master' into antonpirker/code-changes-for-sdk-3.0.0
sentrivana Jul 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ filterwarnings = [

# pytest has not yet implemented the replacement for this yet
"ignore:The --looponfail command line argument.*",

# TODO-anton: just for testing locally, remove before merging
"ignore::DeprecationWarning:setuptools._distutils.version",
"ignore::DeprecationWarning:redis.connection"
]
looponfailroots = ["src", "tests"]

Expand Down
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ sentry-ophio>=1.1.3
sentry-protos==0.2.0
sentry-redis-tools>=0.5.0
sentry-relay>=0.9.9
sentry-sdk[http2]>=2.29.1
sentry-sdk[http2]==3.0.0a1
slack-sdk>=3.27.2
snuba-sdk>=3.0.43
simplejson>=3.17.6
Expand Down
10 changes: 8 additions & 2 deletions requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cryptography==44.0.1
cssselect==1.0.3
cssutils==2.9.0
datadog==0.49.1
deprecated==1.2.18
devservices==1.1.6
distlib==0.3.8
distro==1.8.0
Expand Down Expand Up @@ -82,6 +83,7 @@ httpx==0.25.2
hyperframe==6.1.0
identify==2.6.1
idna==3.7
importlib-metadata==8.6.1
inflection==0.5.1
iniconfig==1.1.1
iso3166==2.1.1
Expand Down Expand Up @@ -114,6 +116,9 @@ openapi-core==0.18.2
openapi-pydantic==0.4.0
openapi-schema-validator==0.6.2
openapi-spec-validator==0.7.1
opentelemetry-api==1.33.1
opentelemetry-sdk==1.33.1
opentelemetry-semantic-conventions==0.54b1
orjson==3.10.10
outcome==1.2.0
packaging==24.1
Expand Down Expand Up @@ -151,7 +156,7 @@ pytest-fail-slow==0.3.0
pytest-json-report==1.5.0
pytest-metadata==3.1.1
pytest-rerunfailures==15.0
pytest-sentry==0.3.0
pytest-sentry==0.4.1
pytest-workaround-12888==1.0.0
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
Expand Down Expand Up @@ -190,7 +195,7 @@ sentry-ophio==1.1.3
sentry-protos==0.2.0
sentry-redis-tools==0.5.0
sentry-relay==0.9.9
sentry-sdk==2.29.1
sentry-sdk==3.0.0a1
sentry-usage-accountant==0.0.10
simplejson==3.17.6
six==1.17.0
Expand Down Expand Up @@ -246,6 +251,7 @@ wheel==0.38.4
wrapt==1.17.0
wsproto==1.1.0
xmlsec==1.3.14
zipp==3.21.0
zstandard==0.18.0

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pytest-django>=4.9.0
pytest-fail-slow>=0.3.0
pytest-json-report>=1.5.0
pytest-rerunfailures>=15
pytest-sentry>=0.3.0,<0.4.0
pytest-sentry>=0.4.0
pytest-workaround-12888
pytest-xdist>=3
responses>=0.23.1
Expand Down
9 changes: 8 additions & 1 deletion requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ cryptography==44.0.1
cssselect==1.0.3
cssutils==2.9.0
datadog==0.49.1
deprecated==1.2.18
distro==1.8.0
django==5.2.1
django-crispy-forms==1.14.0
Expand Down Expand Up @@ -67,6 +68,7 @@ httpcore==1.0.2
httpx==0.25.2
hyperframe==6.1.0
idna==3.7
importlib-metadata==8.6.1
inflection==0.5.1
iso3166==2.1.1
isodate==0.6.1
Expand All @@ -82,6 +84,9 @@ mmh3==4.0.0
msgpack==1.1.0
oauthlib==3.1.0
openai==1.3.5
opentelemetry-api==1.33.1
opentelemetry-sdk==1.33.1
opentelemetry-semantic-conventions==0.54b1
orjson==3.10.10
packaging==24.1
parsimonious==0.10.0
Expand Down Expand Up @@ -128,7 +133,7 @@ sentry-ophio==1.1.3
sentry-protos==0.2.0
sentry-redis-tools==0.5.0
sentry-relay==0.9.9
sentry-sdk==2.29.1
sentry-sdk==3.0.0a1
sentry-usage-accountant==0.0.10
simplejson==3.17.6
six==1.17.0
Expand All @@ -154,7 +159,9 @@ urllib3==2.2.2
vine==5.1.0
vroomrs==0.1.4
wcwidth==0.2.13
wrapt==1.17.2
xmlsec==1.3.14
zipp==3.21.0
zstandard==0.18.0

# The following packages are considered to be unsafe in a requirements file:
Expand Down
4 changes: 3 additions & 1 deletion src/sentry/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ def dispatch(self, request: Request, *args, **kwargs) -> Response:
op="base.dispatch.sleep",
name=type(self).__name__,
) as span:
span.set_data("SENTRY_API_RESPONSE_DELAY", settings.SENTRY_API_RESPONSE_DELAY)
span.set_attribute(
"SENTRY_API_RESPONSE_DELAY", settings.SENTRY_API_RESPONSE_DELAY
)
time.sleep(settings.SENTRY_API_RESPONSE_DELAY / 1000.0 - duration)

# Only enforced in dev environment
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/api/bases/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from sentry.utils import auth
from sentry.utils.hashlib import hash_values
from sentry.utils.numbers import format_grouped_length
from sentry.utils.sdk import bind_organization_context, set_span_data
from sentry.utils.sdk import bind_organization_context, set_span_attribute


class NoProjects(Exception):
Expand Down Expand Up @@ -408,7 +408,7 @@ def get_projects(

with sentry_sdk.start_span(op="fetch_organization_projects") as span:
projects = list(qs)
span.set_data("Project Count", len(projects))
span.set_attribute("Project Count", len(projects))

filter_by_membership = not bool(ids) and not bool(slugs)
filtered_projects = self._filter_projects_by_permissions(
Expand All @@ -434,7 +434,7 @@ def _filter_projects_by_permissions(
include_all_accessible: bool = False,
) -> list[Project]:
with sentry_sdk.start_span(op="apply_project_permissions") as span:
span.set_data("Project Count", len(projects))
span.set_attribute("Project Count", len(projects))
if force_global_perms:
span.set_tag("mode", "force_global_perms")
return projects
Expand Down Expand Up @@ -569,7 +569,7 @@ def get_filter_params(
len_projects = len(projects)
sentry_sdk.set_tag("query.num_projects", len_projects)
sentry_sdk.set_tag("query.num_projects.grouped", format_grouped_length(len_projects))
set_span_data("query.num_projects", len_projects)
set_span_attribute("query.num_projects", len_projects)

params: FilterParams = {
"start": start,
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/api/endpoints/group_current_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def get(self, request: Request, group) -> Response:
environments = get_environments(request, group.project.organization)

with sentry_sdk.start_span(op="CurrentReleaseEndpoint.get.current_release") as span:
span.set_data("Environment Count", len(environments))
span.set_data(
span.set_attribute("Environment Count", len(environments))
# TODO-anton: split dict into multiple attributes
span.set_attribute(
"Raw Parameters",
{
"group.id": group.id,
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/api/endpoints/organization_event_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from sentry.snuba.dataset import Dataset
from sentry.snuba.query_sources import QuerySource
from sentry.snuba.referrer import Referrer
from sentry.utils.sdk import set_span_data
from sentry.utils.sdk import set_span_attribute

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

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

# Nothing to add comparisons to
set_span_data("query.groups", len(group_to_span_map))
set_span_attribute("query.groups", len(group_to_span_map))
if len(group_to_span_map) == 0:
return

Expand Down Expand Up @@ -77,7 +77,7 @@ def add_comparison_to_event(event, average_columns, request: Request):
),
)
)
set_span_data("query.groups_found", len(result["data"]))
set_span_attribute("query.groups_found", len(result["data"]))
for row in result["data"]:
group = row["span.group"]
for span in group_to_span_map[group]:
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/endpoints/organization_events_facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def data_fn(offset, limit):
)

with sentry_sdk.start_span(op="discover.endpoint", name="populate_results") as span:
span.set_data("facet_count", len(facets or []))
span.set_attribute("facet_count", len(facets or []))
resp: dict[str, _KeyTopValues]
resp = defaultdict(lambda: {"key": "", "topValues": []})
for row in facets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def query_tag_data(
Returns None if query was not successful which causes the endpoint to return early
"""
with sentry_sdk.start_span(op="discover.discover", name="facets.filter_transform") as span:
span.set_data("query", filter_query)
span.set_attribute("query", filter_query)
tag_query = DiscoverQueryBuilder(
dataset=Dataset.Discover,
params={},
Expand Down Expand Up @@ -391,7 +391,7 @@ def query_facet_performance(
tag_key_limit = limit if tag_key else 1

with sentry_sdk.start_span(op="discover.discover", name="facets.filter_transform") as span:
span.set_data("query", filter_query)
span.set_attribute("query", filter_query)
tag_query = DiscoverQueryBuilder(
dataset=Dataset.Discover,
params={},
Expand All @@ -417,8 +417,8 @@ def query_facet_performance(
)

with sentry_sdk.start_span(op="discover.discover", name="facets.aggregate_tags"):
span.set_data("sample_rate", sample_rate)
span.set_data("target_sample", target_sample)
span.set_attribute("sample_rate", sample_rate)
span.set_attribute("target_sample", target_sample)
aggregate_comparison = transaction_aggregate * 1.005 if transaction_aggregate else 0
aggregate_column = Function("avg", [translated_aggregate_column], "aggregate")
tag_query.where.append(excluded_tags)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/endpoints/organization_events_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get(self, request: Request, organization) -> Response:

with sentry_sdk.start_span(op="discover.endpoint", name="serialize_results") as span:
results = list(results_cursor)
span.set_data("result_length", len(results))
span.set_attribute("result_length", len(results))
context = serialize(
results,
request.user,
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/api/endpoints/organization_events_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def get(self, request: Request, organization: Organization) -> Response:
query_source = self.get_request_source(request)

with sentry_sdk.start_span(op="discover.endpoint", name="filter_params") as span:
span.set_data("organization", organization)
# TODO-anton: split dict into multiple attributes
span.set_attribute("organization", organization)

top_events = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def get_comparison_delta(self, request: Request) -> timedelta | None:

def get(self, request: Request, organization: Organization) -> Response:
with sentry_sdk.start_span(op="discover.endpoint", name="filter_params") as span:
span.set_data("organization", organization)
# TODO-anton: split dict into multiple attributes
span.set_attribute("organization", organization)

top_events = self.get_top_events(request)
comparison_delta = self.get_comparison_delta(request)
Expand Down
14 changes: 7 additions & 7 deletions src/sentry/api/endpoints/organization_events_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from sentry.snuba.referrer import Referrer
from sentry.utils.iterators import chunked
from sentry.utils.numbers import base32_encode, format_grouped_length
from sentry.utils.sdk import set_span_data
from sentry.utils.sdk import set_span_attribute
from sentry.utils.snuba import bulk_snuba_queries
from sentry.utils.validators import INVALID_ID_DETAILS, is_event_id, is_span_id

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

if ts_params["max"] and ts_params["min"]:
set_span_data(
set_span_attribute(
"trace_view.trace_duration", (ts_params["max"] - ts_params["min"]).total_seconds()
)
sentry_sdk.set_tag("trace_view.missing_timestamp_constraints", False)
Expand Down Expand Up @@ -899,7 +899,7 @@ def augment_transactions_with_spans(
total_chunks = 3
else:
total_chunks = 4
set_span_data("trace_view.span_query.total_chunks", total_chunks)
set_span_attribute("trace_view.span_query.total_chunks", total_chunks)
chunks = chunked(list_spans, (len(list_spans) // total_chunks) + 1)
queries = [build_span_query(trace_id, spans_params, chunk) for chunk in chunks]
results = bulk_snuba_queries(
Expand Down Expand Up @@ -1046,7 +1046,7 @@ def record_analytics(
sentry_sdk.set_tag(
"trace_view.transactions.grouped", format_grouped_length(len_transactions)
)
set_span_data("trace_view.transactions", len_transactions)
set_span_attribute("trace_view.transactions", len_transactions)

projects: set[int] = set()
for transaction in transactions:
Expand All @@ -1055,7 +1055,7 @@ def record_analytics(
len_projects = len(projects)
sentry_sdk.set_tag("trace_view.projects", len_projects)
sentry_sdk.set_tag("trace_view.projects.grouped", format_grouped_length(len_projects))
set_span_data("trace_view.projects", len_projects)
set_span_attribute("trace_view.projects", len_projects)

def get(self, request: Request, organization: Organization, trace_id: str) -> HttpResponse:
if not request.user.is_authenticated:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def get(self, request: Request, organization: Organization) -> Response:
return Response({"detail": "missing required parameter yAxis"}, status=400)

with sentry_sdk.start_span(op="discover.metrics.endpoint", name="get_full_metrics") as span:
span.set_data("organization", organization)
# TODO-anton: split dict into multiple attributes
span.set_attribute("organization", organization)

try:
# the discover stats
Expand Down
8 changes: 5 additions & 3 deletions src/sentry/api/endpoints/organization_profiling_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sentry.snuba.dataset import Dataset
from sentry.snuba.referrer import Referrer
from sentry.utils.dates import parse_stats_period, validate_interval
from sentry.utils.sdk import set_span_data
from sentry.utils.sdk import set_span_attribute
from sentry.utils.snuba import bulk_snuba_queries

TOP_FUNCTIONS_LIMIT = 50
Expand Down Expand Up @@ -202,7 +202,7 @@ def get_trends_data(stats_data) -> list[BreakpointData]:
trending_functions = get_trends_data(stats_data)

all_trending_functions_count = len(trending_functions)
set_span_data("profiling.top_functions", all_trending_functions_count)
set_span_attribute("profiling.top_functions", all_trending_functions_count)

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

filtered_trending_functions_count = all_trending_functions_count - len(trending_functions)
set_span_data("profiling.top_functions.below_threshold", filtered_trending_functions_count)
set_span_attribute(
"profiling.top_functions.below_threshold", filtered_trending_functions_count
)

# Make sure to sort the results so that it's in order of largest change
# to smallest change (ASC/DESC depends on the trend type)
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/api/endpoints/organization_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sentry.api.utils import clamp_date_range, handle_query_errors
from sentry.snuba.dataset import Dataset
from sentry.utils.numbers import format_grouped_length
from sentry.utils.sdk import set_span_data
from sentry.utils.sdk import set_span_attribute


@region_silo_endpoint
Expand Down Expand Up @@ -83,6 +83,6 @@ def get(self, request: Request, organization) -> Response:
format_grouped_length(len(results), [1, 10, 50, 100]),
)
sentry_sdk.set_tag("dataset_queried", dataset.value)
set_span_data("custom_tags.count", len(results))
set_span_attribute("custom_tags.count", len(results))

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