Skip to content
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

ref(node): Only show instrumentation warning when tracing is enabled #12141

Merged

Conversation

andreiborza
Copy link
Member

Also gives a better warning in ESM mode with a helpful link to the docs.

@andreiborza andreiborza requested a review from mydea May 21, 2024 13:19
@andreiborza andreiborza force-pushed the ab/warn-instrumentation-only-when-tracing-enabled branch from cd1e4c7 to 2855d9b Compare May 21, 2024 13:22
@@ -48,12 +50,19 @@ export const setupConnectErrorHandler = (app: ConnectApp): void => {
});
}

if (!isWrapped(app.use) && isEnabled()) {
if (!isWrapped(app.use) && isEnabled() && hasTracingEnabled()) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we maybe extract this into a utility and re-use this? Could be something like this:

function ensureIsWrapped(maybeWrappedModule: unknown, name: string): void {
  if (!isWrapped(maybeWrappedModule) && isEnabled() && hasTracingEnabled()) {
    // ...
  }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Extracted, could you please have another look 🙏

@mydea mydea changed the title ref(node): Only show instrumentation warning when tracing is enabled (#12119) ref(node): Only show instrumentation warning when tracing is enabled May 21, 2024
Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

very nice!

@andreiborza andreiborza force-pushed the ab/warn-instrumentation-only-when-tracing-enabled branch from b1b8402 to e123f24 Compare May 21, 2024 14:30
@andreiborza andreiborza force-pushed the ab/warn-instrumentation-only-when-tracing-enabled branch from e123f24 to 239817f Compare May 22, 2024 07:19
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser 21.72 KB (0%)
@sentry/browser (incl. Tracing) 32.88 KB (0%)
@sentry/browser (incl. Tracing, Replay) 68.23 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.61 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 72.27 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 84.3 KB (0%)
@sentry/browser (incl. Feedback) 37.71 KB (0%)
@sentry/browser (incl. sendFeedback) 26.29 KB (0%)
@sentry/browser (incl. FeedbackAsync) 30.69 KB (0%)
@sentry/react 24.41 KB (0%)
@sentry/react (incl. Tracing) 35.87 KB (0%)
@sentry/vue 25.66 KB (0%)
@sentry/vue (incl. Tracing) 34.69 KB (0%)
@sentry/svelte 21.86 KB (0%)
CDN Bundle 24.26 KB (0%)
CDN Bundle (incl. Tracing) 34.31 KB (0%)
CDN Bundle (incl. Tracing, Replay) 68 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 73 KB (0%)
CDN Bundle - uncompressed 71.33 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 101.74 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 211.36 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 223.72 KB (0%)
@sentry/nextjs (client) 35.09 KB (0%)
@sentry/sveltekit (client) 33.46 KB (0%)
@sentry/node 128.26 KB (-4.45% 🔽)
@sentry/aws-serverless 114.27 KB (-10.88% 🔽)

@andreiborza andreiborza merged commit a30fbbc into develop May 22, 2024
85 checks passed
@andreiborza andreiborza deleted the ab/warn-instrumentation-only-when-tracing-enabled branch May 22, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants