Skip to content

fix(replay): Use correct replay category in client reports #6889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 20, 2023

After adjusting the _admin UI to display outcomes of replay events (https://github.com/getsentry/getsentry/pull/9301), we noticed that only server-side outcomes are shown. After some investigation, I found out that the client reports our SDKs send to Sentry contain the wrong category for replay events:

Instead of replay_event (or replay_recording) the valid category for client reports should simply be replay.

To fix this, this PR first adds a conversion function to the recordDroppedEvent function (which collects the client outcomes) and secondly, it adds two new DataCategory types for rate limits and client reports. This is necessary because replay event types and rate-limit/client-report categories aren't identical anymore. While it'd arguably be better that they are in fact identical, I think this is the quickest fix and the types should help us distinguishing the applicable categories going forward.

ref #6502

@Lms24 Lms24 requested a review from mydea January 20, 2023 12:15
Comment on lines -13 to -14
// Replay type event
| 'replay_event'
Copy link
Member Author

Choose a reason for hiding this comment

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

This was just a duplicated entry

@@ -337,13 +338,15 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
// Note: we use `event` in replay, where we overwrite this hook.

if (this._options.sendClientReports) {
// We want to track each category (error, transaction, session, replay_event) separately
const clientReportCategory = dataCategoryToClientReportCategory(category);
Copy link
Member Author

@Lms24 Lms24 Jan 20, 2023

Choose a reason for hiding this comment

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

Arguably, it'd be cleaner to change the method's signature type to ClientReportCategory but this is breaking. Also, we'd need to call the conversion function more often which increases bundle size

@Lms24 Lms24 self-assigned this Jan 20, 2023
@Lms24 Lms24 added the Package: replay Issues related to the Sentry Replay SDK label Jan 20, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.85 KB (+0.13% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 61.54 KB (+0.12% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.51 KB (+0.09% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.84 KB (+0.14% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.24 KB (+0.15% 🔺)
@sentry/browser - Webpack (minified) 66.26 KB (+0.13% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.26 KB (+0.12% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.5 KB (+0.05% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.77 KB (+0.09% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.05 KB (+0.09% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.26 KB (+0.01% 🔺)
@sentry/replay - Webpack (gzipped + minified) 38.04 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.54 KB (+0.04% 🔺)

@mydea
Copy link
Member

mydea commented Jan 20, 2023

Actually, I think there is a better/easier fix for this:

  1. remove the replay_XXX data categories
  2. add replay category instead
  3. Map them here: https://github.com/getsentry/sentry-javascript/blob/master/packages/utils/src/envelope.ts#L184

I think that should work...?

@mydea
Copy link
Member

mydea commented Jan 20, 2023

Made a draft to show what I mean, I am honestly not 100% sure if I am missing something here, but I think that should have the outcome we want: #6891 ?? WDYT?

@Lms24
Copy link
Member Author

Lms24 commented Jan 20, 2023

Closing in favour of #6891

@Lms24 Lms24 closed this Jan 20, 2023
@Lms24 Lms24 deleted the lms-fix-replay-clientreport-categories branch December 3, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: replay Issues related to the Sentry Replay SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants