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-5639): keep executing context on queued commands #3871

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

david-luna
Copy link

@david-luna david-luna commented Sep 18, 2023

Description

Implementation for https://jira.mongodb.org/browse/NODE-5639

Make use of AsyncResource.bind API to bind the current execution context of WaitQueueMember callback.

The change proposed will make callbacks to have the same context they where created. Useful if the consumer of the package is using AsyncLocalStorage to keep state.

One use case is APM agents. They make use of these APIs to keep context between callbacks and async calls.

What is changing?

Bind the current execution context to WaitQueueMember callback property.

Is there new documentation needed for these changes?

No

What is the motivation for this change?

Get span hierarchy right when mongodb driver is instrumented by an APM agent like Opentelemetry, Elastic, DataDog...

Release Highlight

Fill in title or leave empty for no highlight

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@david-luna david-luna marked this pull request as ready for review September 18, 2023 16:59
@nbbeeken nbbeeken added the External Submission PR submitted from outside the team label Sep 18, 2023
@david-luna david-luna changed the title feat(NODE-5639): bind WaitQueueMember callback to current context feat(NODE-5639): keep executing context on queued commands Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Submission PR submitted from outside the team tracked-in-jira Ticket filed in MongoDB's Jira system
Projects
None yet
2 participants