Skip to content

Conversation

@cliffordxing
Copy link
Contributor

This PR is in regards to the following issue: https://sentry.sentry.io/issues/7061220977/?alert_rule_id=14394965&alert_type=issue&notification_uuid=c59f28da-3fac-4c5f-8e8c-f54412d24dc5&project=11276&referrer=slack

Upon further exploration, it seems like the EAP replay query is unable to find any timestamp data:

image

This is likely because the timestamp column is not placed as an attribute when we create the trace item.

Relates to: https://linear.app/getsentry/issue/REPLAY-824/create-query-function-for-replay-details

@cliffordxing cliffordxing requested a review from a team as a code owner November 25, 2025 22:56
@linear
Copy link

linear bot commented Nov 25, 2025

@cliffordxing cliffordxing changed the title fix(Replay): Include timestamp Attribute in Trace Item fix(Replay): Include Timestamp Attribute in Trace Item Nov 25, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 25, 2025
Comment on lines 3860 to 3865
"replay_id": replay_id,
"segment_id": segment_id,
"project_id": project.id,
"timestamp": int(timestamp.timestamp()),
"category": category,
}

Copy link

Choose a reason for hiding this comment

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

Bug: The create_eap_replay_breadcrumb() helper is missing the sentry.timestamp attribute in its generated attributes dictionary, causing queries to return NULL for timestamp aggregations.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The create_eap_replay_breadcrumb() helper in src/sentry/testutils/cases.py no longer populates the sentry.timestamp attribute in the attributes dictionary. This omission occurs because the line "timestamp": int(timestamp.timestamp()) was removed without a replacement that adds sentry.timestamp to attributes_proto. Consequently, queries in organization_replay_details.py that depend on min(sentry.timestamp) and max(sentry.timestamp) will return NULL for started_at and finished_at. This will cause related test assertions to fail and the replay details UI to display incorrect NULL values.

💡 Suggested Fix

In create_eap_replay_breadcrumb(), add attributes_proto["sentry.timestamp"] = AnyValue(int_value=int(timestamp.timestamp() * 1e9)) to correctly populate the sentry.timestamp attribute, similar to OurLogTestCase.create_ourlog().

🤖 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/testutils/cases.py#L3860-L3865

Potential issue: The `create_eap_replay_breadcrumb()` helper in
`src/sentry/testutils/cases.py` no longer populates the `sentry.timestamp` attribute in
the `attributes` dictionary. This omission occurs because the line `"timestamp":
int(timestamp.timestamp())` was removed without a replacement that adds
`sentry.timestamp` to `attributes_proto`. Consequently, queries in
`organization_replay_details.py` that depend on `min(sentry.timestamp)` and
`max(sentry.timestamp)` will return `NULL` for `started_at` and `finished_at`. This will
cause related test assertions to fail and the replay details UI to display incorrect
`NULL` values.

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

@cliffordxing cliffordxing merged commit 982cd52 into master Nov 26, 2025
67 checks passed
@cliffordxing cliffordxing deleted the time-stamp-attribute branch November 26, 2025 20:25
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.

3 participants