refactor: Updated config.instrumentation.timers.enabled to false to disable timers.setTimeout and timers.setInterval by default.
#3414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The Node.js agent instrumented
setTimeoutandsetInterval. This was done many years ago to propagate async context through timers. When we introduced an async context manager based onAsyncLocalStoragethis instrumentation isn't necessary. On top of that, not only did we propagate context but we created segments/spans for these actions. This caused a lot of unncessary segments/spans to show that a setTimeout or setInterval was called. This PR disables the timers instrumentation by default. Aside from creating useless segments/spans, it typically spammed the debug+ level logger because a lot of 3rd party libraries and applications rely onsetTimeoutandsetIntervalto drive internals. You would see a lot of not recordingsetTimeoutsetIntervalbecause it was not in an active transaction. Now, durations of child instrumented actions will be accounted for in the actual functions and not in thesetTimeoutorsetInterval. However, if customers still want this level of observability, they can re-enable the instrumentation viaconfig.instrumentation.timers.enabledtotrueorNEW_RELIC_INSTRUMENTATION_TIMERS_ENABLEDtotrue.Note: I had to open a branch of
@newrelic/apollo-server-pluginto fix segment trees without timers. That PR will fail until we release the agent.Related Issues
Closes #3084