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

feat(node): Send client reports #12951

Merged
merged 7 commits into from
Jul 22, 2024
Merged

feat(node): Send client reports #12951

merged 7 commits into from
Jul 22, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Jul 17, 2024

Resolves #12822

This PR adds client reports to the Node.js SDK.

Client reports must be enabled via the startClientReportTracking() method on the NodeClient. This is due to the fact that client reports (or rather the setInterval that is required for periodically sending them) is acquiring a resource that needs cleanup. If somebody were to create clients over and over again, without calling client.close() they would be leaking memory.

If startClientReportTracking() is called, the client will flush all client reports

  • every 60 seconds.
  • on process.on('beforeExit'), which is when the event loop has run out of things to do.

Out of the box, the Node.js SDK's Sentry.init() will call startClientReportTracking(), since there we can assume that users are using a singular client.

We are also introducing a new option for the Node.js SDK called clientReportFlushInterval that will control the flush interval of the periodic client report flushing.

Copy link
Contributor

github-actions bot commented Jul 17, 2024

size-limit report 📦

Path Size
@sentry/browser 22.31 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) 33.72 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) 69.81 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 63.15 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 74.21 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) 86.52 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 88.4 KB (+0.01% 🔺)
@sentry/browser (incl. metrics) 26.62 KB (+0.02% 🔺)
@sentry/browser (incl. Feedback) 38.98 KB (+0.02% 🔺)
@sentry/browser (incl. sendFeedback) 26.93 KB (+0.03% 🔺)
@sentry/browser (incl. FeedbackAsync) 31.54 KB (+0.02% 🔺)
@sentry/react 25.08 KB (+0.07% 🔺)
@sentry/react (incl. Tracing) 36.8 KB (+0.04% 🔺)
@sentry/vue 26.45 KB (+0.03% 🔺)
@sentry/vue (incl. Tracing) 35.61 KB (+0.05% 🔺)
@sentry/svelte 22.44 KB (+0.03% 🔺)
CDN Bundle 23.52 KB (0%)
CDN Bundle (incl. Tracing) 35.5 KB (0%)
CDN Bundle (incl. Tracing, Replay) 69.9 KB (-0.01% 🔽)
CDN Bundle (incl. Tracing, Replay, Feedback) 75.17 KB (-0.01% 🔽)
CDN Bundle - uncompressed 69 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 105.1 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 216.88 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 229.6 KB (0%)
@sentry/nextjs (client) 36.66 KB (+0.04% 🔺)
@sentry/sveltekit (client) 34.39 KB (+0.04% 🔺)
@sentry/node 111.57 KB (+0.26% 🔺)
@sentry/node - without tracing 89 KB (+0.33% 🔺)
@sentry/aws-serverless 98.17 KB (+0.29% 🔺)

@lforst lforst force-pushed the node-client-reports branch from cb11d4c to b3008b6 Compare July 22, 2024 09:00
@lforst lforst marked this pull request as ready for review July 22, 2024 12:15
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.

nice work!

@lforst lforst enabled auto-merge (squash) July 22, 2024 13:47
@lforst lforst merged commit 849d1cf into develop Jul 22, 2024
122 checks passed
@lforst lforst deleted the node-client-reports branch July 22, 2024 13:52
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.

Implement client reports for Node
2 participants