Skip to content

Commit 65155a5

Browse files
mrduncanclaude
andcommitted
fix(issues): Exclude HTTP spans under all gen_ai.* ops from consecutive HTTP detector
The consecutive HTTP detector only excluded HTTP spans parented to gen_ai.chat spans. Agentic AI workflows use gen_ai.invoke_agent and other gen_ai.* ops, causing false positive detections on inherently sequential LLM call loops. Broaden the filter from gen_ai.chat to any span with a gen_ai.* prefix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a42598b commit 65155a5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/sentry/issue_detection/detectors/consecutive_http_detector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def __init__(
4242

4343
self.consecutive_http_spans: list[Span] = []
4444
self.lcp = None
45-
self.gen_ai_chat_spans: list[str] = [
45+
self.gen_ai_spans: list[str] = [
4646
span.get("span_id")
4747
for span in event.get("spans", [])
48-
if span.get("op") == "gen_ai.chat"
48+
if (span.get("op") or "").startswith("gen_ai.")
4949
]
5050

5151
lcp_value = get_path(self.event(), "measurements", "lcp", "value")
@@ -179,7 +179,7 @@ def _is_eligible_http_span(self, span: Span) -> bool:
179179
if not op.startswith("http.client"):
180180
return False
181181

182-
if span.get("parent_span_id") in self.gen_ai_chat_spans:
182+
if span.get("parent_span_id") in self.gen_ai_spans:
183183
return False
184184

185185
if (

tests/sentry/issue_detection/test_consecutive_http_detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def test_ignores_non_http_operations(self) -> None:
399399
assert len(problems) == 0
400400

401401
def test_ignores_http_spans_with_gen_ai_parent(self) -> None:
402-
"""Test that HTTP spans with gen_ai.chat parent spans are ignored."""
402+
"""Test that HTTP spans with gen_ai.* parent spans are ignored."""
403403
span_duration = 2000
404404

405405
# Create a gen_ai.chat span first

0 commit comments

Comments
 (0)