Skip to content

Commit 588673c

Browse files
authored
fix(events-trace-meta): Remove indexed spans usage (#95374)
The only orgs still using this endpoint should not have any data in indexed spans. So we can remove this query.
1 parent 4584a12 commit 588673c

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

src/sentry/api/endpoints/organization_events_trace.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,32 +1767,12 @@ def get(self, request: Request, organization: Organization, trace_id: str) -> Ht
17671767
query=f"trace:{trace_id}",
17681768
limit=1,
17691769
)
1770-
transaction_children_query = SpansIndexedQueryBuilder(
1771-
dataset=Dataset.SpansIndexed,
1772-
selected_columns=[
1773-
"transaction.id",
1774-
"count()",
1775-
],
1776-
orderby=["transaction.id"],
1777-
params={},
1778-
snuba_params=snuba_params,
1779-
query=f"trace:{trace_id}",
1780-
limit=10_000,
1781-
)
17821770

17831771
with handle_query_errors():
1784-
results = bulk_snuba_queries(
1785-
[
1786-
meta_query.get_snql_query(),
1787-
transaction_children_query.get_snql_query(),
1788-
],
1772+
meta_result = meta_query.run_query(
17891773
referrer=Referrer.API_TRACE_VIEW_GET_META.value,
17901774
query_source=query_source,
17911775
)
1792-
meta_result, children_result = (
1793-
results[0],
1794-
results[1],
1795-
)
17961776
if len(meta_result["data"]) == 0:
17971777
return Response(status=404)
17981778
# Merge the result back into the first query
@@ -1804,22 +1784,20 @@ def get(self, request: Request, organization: Organization, trace_id: str) -> Ht
18041784
return Response(
18051785
self.serialize(
18061786
meta_result["data"][0],
1807-
children_result["data"],
18081787
)
18091788
)
18101789

18111790
def serialize(
18121791
self,
18131792
results: Mapping[str, int],
1814-
child_result: Any,
1815-
) -> Mapping[str, int | dict[str, int]]:
1793+
) -> Mapping[str, int | dict[str, int] | list[Any]]:
18161794
return {
18171795
# Values can be null if there's no result
18181796
"projects": results.get("projects") or 0,
18191797
"transactions": results.get("transactions") or 0,
18201798
"errors": results.get("errors") or 0,
18211799
"performance_issues": results.get("performance_issues") or 0,
18221800
"span_count": 0,
1823-
"transaction_child_count_map": child_result,
1801+
"transaction_child_count_map": [],
18241802
"span_count_map": {},
18251803
}

tests/snuba/api/endpoints/test_organization_events_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1763,4 +1763,4 @@ def test_with_default(self):
17631763
assert data["performance_issues"] == 2
17641764
assert data["span_count"] == 0
17651765
assert data["span_count_map"] == {}
1766-
assert len(data["transaction_child_count_map"]) == 8
1766+
assert len(data["transaction_child_count_map"]) == 0

0 commit comments

Comments
 (0)