Skip to content

ref(replay): Hide internal replay tracing behind experiments flag #6487

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

Merged
merged 5 commits into from
Dec 12, 2022

Conversation

mydea
Copy link
Member

@mydea mydea commented Dec 9, 2022

As a follow up to #6482, this adds a traceInternals experiment to replay which can be set to ensure traces for sentry-internal stuff are added.

Also, make sure that the experiments stuff is filtered out when not in debug mode.

Note that one place where we've been checking the sentry DSN has been removed here, namely createPerformanceEntry. The reason is that these are already anyhow filtered out when they are of type fetch or xmlhttprequest, and there aren't really any other types of entries there that we could be creating (as far as I can tell - see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/initiatorType).

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Dec 9, 2022
@mydea mydea requested review from billyvg and Lms24 December 9, 2022 13:54
@mydea mydea self-assigned this Dec 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.68 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.96 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.47 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.51 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.27 KB (0%)
@sentry/browser - Webpack (minified) 66.25 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.29 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.29 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.67 KB (0%)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.12 KB (+0.01% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 41.64 KB (-0.37% 🔽)
@sentry/replay - Webpack (gzipped + minified) 37.96 KB (+0.21% 🔺)

Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

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

Looks good, how do we turn on experiments?

@@ -1,18 +0,0 @@
import { getCurrentHub } from '@sentry/core';

import { isInternal } from './isInternal';
Copy link
Member

Choose a reason for hiding this comment

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

Is this still used elsewhere? Can the file be removed too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, you're right, completely forgot this!

exc?.value || 'n/a'
}`,
});
if (__DEBUG_BUILD__ && replay.getOptions()._experiments?.traceInternals) {
Copy link
Member

Choose a reason for hiding this comment

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

__DEBUG_BUILD__ is turned on by debug: true in init() right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, when using npm install this is always true I believe (unless you set it in your bundler config yourself), but e.g. in CDNs for "non-debug" bundles this will be false, and thus everything else can be stripped because it is statically an analyzable :)

@mydea
Copy link
Member Author

mydea commented Dec 12, 2022

Looks good, how do we turn on experiments?

Just pass this in as configuration:

new Replay({
  _experiments: {
    captureExceptions: true,
    traceInternals: true,
  }
});

@mydea mydea force-pushed the fn/replay-experiments branch from 362cec5 to a982365 Compare December 12, 2022 08:20
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

🚀

@mydea mydea merged commit b4efa21 into master Dec 12, 2022
@mydea mydea deleted the fn/replay-experiments branch December 12, 2022 10:00
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.

3 participants