Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Best practices regarding Sentry in worker threads #16370

Unanswered
pavlos163 asked this question in Q&A
Discussion options

Setup

  • Node.js application with main thread + worker threads (using worker_threads module)
  • Sentry initialized in both main thread and each worker thread
  • Mongoose used for database operations
  • Worker threads perform scheduled tasks (Bree) and exit after completion

Sentry configuration

Sentry.init({
 enabled: true,
 dsn: process.env.SENTRY_DSN,
 environment: process.env.NODE_ENV,
 integrations: [
 Sentry.nodeProfilingIntegration(),
 Sentry.extraErrorDataIntegration(),
 Sentry.httpIntegration({
 ignoreOutgoingRequests: (url) => url.includes("someservice")
 }),
 Sentry.mongoIntegration(),
 Sentry.mongooseIntegration()
 ],
 profilesSampler: () => 0.2,
 tracesSampler: () => 0.2
});

Questions

  • Is it safe to call Sentry.init() in multiple worker threads with the same configuration?
  • Do the mongoIntegration() and mongooseIntegration() create shared state that could cause issues across worker threads?
  • Are there recommended patterns for using Sentry with Node.js worker threads?

Environment

  • Node.js: v20.x
  • Sentry version: 9.17.0
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /