Skip to content

Conversation

@wmak
Copy link
Member

@wmak wmak commented Dec 5, 2025

  • Move query logging so we have it in even more places
  • add some logging to the timeseries/table responses too

- Move query logging so we have it in even more places
- add some logging to the timeseries/table responses too
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 5, 2025
from sentry.utils import json, metrics
from sentry.utils.snuba import SnubaError, _snuba_pool

logger = logging.getLogger(__name__)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Removed log_rpc_request() function but left an orphaned call site in spans_rpc.py, causing an AttributeError on timeout.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The pull request removed the log_rpc_request() function from rpc_dataset_common.py, but a call site in spans_rpc.py (around line 323) was not removed. When a trace query times out during pagination, this orphaned call will attempt to execute rpc_dataset_common.log_rpc_request(), leading to an AttributeError: module 'sentry.snuba.rpc_dataset_common' has no attribute 'log_rpc_request'. This unhandled exception will crash the request handler.

💡 Suggested Fix

Remove the orphaned call to rpc_dataset_common.log_rpc_request() in spans_rpc.py (around line 323) or migrate its logging logic to the new snuba_rpc.py.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/utils/snuba_rpc.py#L52

Potential issue: The pull request removed the `log_rpc_request()` function from
`rpc_dataset_common.py`, but a call site in `spans_rpc.py` (around line 323) was not
removed. When a trace query times out during pagination, this orphaned call will attempt
to execute `rpc_dataset_common.log_rpc_request()`, leading to an `AttributeError: module
'sentry.snuba.rpc_dataset_common' has no attribute 'log_rpc_request'`. This unhandled
exception will crash the request handler.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 5900602

"rpc_rows": rpc_rows,
"meta": timeseries_response.meta,
},
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect log message for timeseries response

The log message for timeseries responses incorrectly states "Table RPC query response" when it should indicate a timeseries response. This appears to be a copy-paste error from the table response logging block above. This will make it difficult to distinguish between table and timeseries query responses in logs, hindering debugging and monitoring efforts.

Fix in Cursor Fix in Web

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