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

fix(metrics): do not report metrics from worker threads #517

Merged
merged 1 commit into from
Apr 1, 2022

Conversation

basti1302
Copy link
Contributor

When instrumented via NODE_OPTIONS="--require ..." (which is inherited by
worker threads), each worker thread will announce independently and act like
the main thread. This can cause issues, in particular if the worker thread is
started from a dependency in node_ module and it identifies a different
package.json as its main package.json, hence reporting a different application
name etc.

To prevent this, we disable sending metrics and snapshot data from
worker threads for now.

fixes #500

refs 88823

@@ -37,6 +46,7 @@ exports.init = function init(config, isReInit) {
// we create later on.
parentLogger = bunyan.createLogger({
name: '@instana/collector',
thread: threadId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the thread ID to the log object is not strictly necessary but we have the PID in there, too, and I think it might be pretty helpful when trouble shooting scenarios involving worker threads in the future.

Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

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

LGTM! Just left some questions :)

When instrumented via NODE_OPTIONS="--require ..." (which is inherited by
worker threads), each worker thread will announce independently and act like
the main thread. This can cause issues, in particular if the worker thread is
started from a dependency in node_ module and it identifies a different
package.json as its main package.json, hence reporting a different application
name etc.

To prevent this, we disable sending metrics and snapshot data from
worker threads for now.

fixes #500

refs 88823
@kirrg001 kirrg001 merged commit bdf7869 into main Apr 1, 2022
@kirrg001 kirrg001 deleted the worker-thread-fix branch April 1, 2022 07:22
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.

[Bug]: Incorrect process identification when pino v7+ transports are used
2 participants