-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(core): Ensure standalone spans are not sent if SDK is disabled #14088
fix(core): Ensure standalone spans are not sent if SDK is disabled #14088
Conversation
@@ -565,7 +565,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> { | |||
|
|||
if (this._isEnabled() && this._transport) { | |||
return this._transport.send(envelope).then(null, reason => { | |||
DEBUG_BUILD && logger.error('Error while sending event:', reason); | |||
DEBUG_BUILD && logger.error('Error while sending envelope:', reason); |
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.
Given that sendEnvelope
is called for multiple envelope item types (not just events), I opted to slightly change the message here to reflect this
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.
makes sense to me! 👍
size-limit report 📦
|
Previously, when standalone (most prominently INP) spans would
.end()
, they'd always be sent to Sentry, even if the SDK was disabled (viaSentry.init({enabled: false})
for example). This was caused by us directly callingtransport.send
and not checking for the enabled option, instead of using the client to send the span envelope.This PR now changes the sending logic to use the client's
sendEnvelope
method which we generally use to send envelopes (sessions, client reports, checkins, metrics (RIP), and also events). This has a minor implication: We will now also emit abeforeEnvelope
client hook event for sending standalone spans. I think this is actually more correct than before but could potentially break someone. IMO this is worth the "risk" as it's easily revertible and client hooks are primarily meant for internal use. Happy to adjust the PR though if reviewers have different opinions.fixes #14082