Skip to content

ref(performance): Get transaction replay count with EAP#113359

Draft
mjq wants to merge 1 commit intomasterfrom
mjq/txn-summary-replay-count
Draft

ref(performance): Get transaction replay count with EAP#113359
mjq wants to merge 1 commit intomasterfrom
mjq/txn-summary-replay-count

Conversation

@mjq
Copy link
Copy Markdown
Member

@mjq mjq commented Apr 17, 2026

Migrate useReplayCountForTransactions off the legacy transactions dataset (via /replay-count/ endpoint) and onto the spans/EAP dataset via useSpans, matching where the rest of insights is moving.

The hook only has one caller (transaction summary header) and only ever asked for a single transaction at a time, so the four-function indirection (getReplayCountForTransaction, getReplayCountForTransactions, transactionHasReplay, transactionsHaveReplay) is dropped in favour of a hook that returns the count directly for the transaction it's called with.

I'm guessing that querying limit + 1 rows instead of a count_unique on replay IDs is faster since we can return results as soon as the limit is reached, but the count() we're doing to dedupe might defeat that. Nonetheless, the query appears faster on Sentry than it used to be (in local testing).

Fixes DAIN-1471.

Also fixes DAIN-1456.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 17, 2026
Comment on lines +10 to +12
if (count === undefined) {
return null;
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This fixes DAIN-1456, by no longer rendering an empty grey background during loading.

Migrate useReplayCountForTransactions off the legacy /replay-count/
endpoint and onto the spans/EAP dataset via useSpans, matching where
the rest of insights is moving. The hook only has one caller
(transaction summary header) and only ever asked for a single
transaction at a time, so the four-function indirection
(getReplayCountForTransaction, getReplayCountForTransactions,
transactionHasReplay, transactionsHaveReplay) is dropped in favor of
a hook that returns the count directly for the transaction it's
called with.

Rather than a count_unique(replay.id) aggregate that scans the full
90d window, query up to 51 rows grouped by replay.id and count them
client-side. ReplayCountBadge already caps display at "50+", so 51
rows is enough to distinguish "50+" from any exact count <= 50 — and
it lets EAP short-circuit the scan. Override statsPeriod inline via
the useSpans pageFilters option so the 90d window the replay tab
wants doesn't get overridden by the page's global time filter.

While the hook is loading, return undefined and have
ReplayCountBadge render nothing so the empty grey pill doesn't flash
before the count arrives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant