Skip to content

fix: safely access description field in MN+1 DB span detector#119472

Draft
billyvg wants to merge 1 commit into
masterfrom
claude/serene-cannon-l6syae
Draft

fix: safely access description field in MN+1 DB span detector#119472
billyvg wants to merge 1 commit into
masterfrom
claude/serene-cannon-l6syae

Conversation

@billyvg

@billyvg billyvg commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

Fixes a KeyError: 'description' that crashes performance problem detection for segments containing spans without a description field. Spans from downsampled data (with downsampled_retention_days set) may omit the description key, causing _maybe_performance_problem in ContinuingMNPlusOne to raise and silently swallow the exception, losing all performance detection for that segment.

Root cause: Two direct dict key accesses db_span["description"] in mn_plus_one_db_span_detector.py lines 258 and 283 — one for the PerformanceProblem.desc field and one for the IssueEvidence display value.

Fix: Changed both to db_span.get("description", "").

Evidence

Sentry issue: SENTRY-5QVDKeyError: 'description' in mn_plus_one_db_span_detector.py:258

  • 297,442 events since 2026-06-25
  • Seer actionability: high
  • Culprit: spans.consumers.process_segments.process_segment

Stack trace confirms the span's local variables show {"downsampled_retention_days":"30", ...} without a description field.

Seer analysis: "Use .get('description', '') to safely access the db span description."

Session

This fix was identified and created by Claude Code: https://claude.ai/code/session_01JhWfwrF5pc1GH772kWC27t

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Generated by Claude Code

Spans from downsampled data may lack a "description" key, causing
KeyError in _maybe_performance_problem and failing all performance
problem detection for that segment. Use .get() with an empty string
default to handle spans without a description field gracefully.

Fixes SENTRY-5QVD
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants