-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(replay): Log warning if sample rates are all undefined #6959
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
Conversation
size-limit report 📦
|
6b5a8c8
to
095dd92
Compare
packages/replay/src/integration.ts
Outdated
const finalOptions = { sessionSampleRate: 0, errorSampleRate: 0, ...dropUndefinedKeys(initialOptions) }; | ||
|
||
if (!opt) { | ||
return finalOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: Hmm in this case we'll also want to check for the warning, I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that in this case, something more fundamental is wrong with the SDK than anything Replay specific. We should always get defined options from the client.
Thinking about it, the typecast above unnecessarily includes | undefined
. I think it should be good to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argh my jet lag isn't helping here - the client could be undefined which is what we're actually checking for here 😅
So yes, we probably should emit another warning there but I'd still argue that it is more a fundamental SDK problem than just the sample rates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jup, right! Maybe we just add a more generic client not found
type message there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 7314883
8eef3df
to
7314883
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Since we decided to set both replay sample rates to 0 by default, we should log a warning that replay will be disabled if no sample rates were passed to Sentry.init. Since we're still supporting the deprecated sample rates in the integration options, this warning will only be emitted if these rates aren't set either.
Had to do some refactoring to nail down the logic as previously, default values were applied too early