feat: initial support for diagnostics_channel TracingChannel API#16137
Open
Neha-Sharmaaa wants to merge 5 commits intoAutomattic:masterfrom
Open
feat: initial support for diagnostics_channel TracingChannel API#16137Neha-Sharmaaa wants to merge 5 commits intoAutomattic:masterfrom
Neha-Sharmaaa wants to merge 5 commits intoAutomattic:masterfrom
Conversation
…ies for multiple documents when possible (Automatticgh-15863)
Author
Usage Example and VerificationYou can subscribe to these channels to monitor Mongoose operations without monkey-patching: const dc = require('node:diagnostics_channel');
// Monitor all Mongoose queries
dc.tracingChannel('mongoose:query').subscribe({
start(ctx) {
console.log('Query Start:', ctx.operation, 'on', ctx.collection);
console.log('Filter:', ctx.query);
},
asyncEnd(ctx) {
console.log('Query End');
},
error(ctx) {
console.error('Query Error:', ctx.error);
}
});
// Works similarly for 'mongoose:aggregate' and 'mongoose:save'Verified locally with a new test suite ( |
… enhance diagnostics
d205e06 to
a056e17
Compare
Author
|
If CI checks aren't showing, a maintainer may need to approve workflow runs from this fork: go to the Actions tab, open the pending workflow run for this PR, and click Approve and run. |
…est coverage across multiple core components and types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem in current implementation
Currently, monitoring Mongoose operations from APM tools requires monkey-patching which is brittle and can lead to performance regressions.
Objective
Enable APM tools (like OpenTelemetry) to instrument Mongoose without monkey-patching, by emitting tracing lifecycle events using diagnostics_channel.
Scope
Implement support for:
Features
Note: This PR is now correctly separated from the populate-limit optimization PR.