Repository navigation
Conversation
A group provided with an async function will now: 1. Treat the whole time it take for the async function promise to finisher the duration of the group. 2. It will also use goja's AsyncContextTracker to make it so that the code using `await` within the group will still continue to be tagged with the group after `await` returns. 3. Instead of directly calling the async function it schedules it to be called the next time a promise job will work. The current AsyncContextTracker is only used for this and as such is directly changed in the `k6` module. In the future there likely will be API so that multiple modules can use it simultaneously, but that seems way too involved to be included in this change and also currently only `group` needs this. fixes #2848 #2728
mstoykov
force-pushed
the
asyncGroupSupport
branch
from
January 19, 2023 15:19
7f348c4 to
cba2e6f
Compare
Contributor
Author
|
Moving this to a draft in favor of #2875 |
mstoykov
marked this pull request as draft
January 25, 2023 15:15
|
How to get notified when this is fixed? |
Contributor
Author
|
For more information you likely should follow #2728 as this PR at this time is very unlikely to be merged as is. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2863 +/- ##
==========================================
- Coverage 76.15% 76.15% -0.01%
==========================================
Files 217 218 +1
Lines 16604 16669 +65
==========================================
+ Hits 12645 12694 +49
- Misses 3185 3196 +11
- Partials 774 779 +5
Flags with carried forward coverage won't be shown. Click here to find out more. β View full report in Codecov by Sentry. |
Contributor
Author
|
I am closing this PR as it is really unlikely we will go down this route |
This was referenced Aug 26, 2026
mstoykov
added a commit
that referenced
this pull request
Sep 15, 2026
Add the experimental async-metric-context feature flag and use it to treat tags and metadata as async-local context. Each promise reaction receives a cloned snapshot, mutations flow to asynchronous work created by that reaction, and the interrupted context is restored when the reaction exits. Install the Sobek async-context tracker when each VU runtime is created. This makes propagation available to promises and modules and installs the tracker before setup or teardown can queue reactions. Provide common helpers for callbacks that run outside Sobek promise reactions. Applying a captured context without metadata measured 84.60 ns/op, 32 B/op, and one allocation in five one-second runs with GOMAXPROCS=1. Four metadata entries measured 480.0 ns/op, 704 B/op, and five allocations. Keep the behavior opt-in through --features async-metric-context, K6_FEATURES, or the JSON features configuration. Disabled runs do not install the tracker or apply callback snapshots. Related issues: #2728 #2848 #3392 #5435 #5673 Earlier proposal: #2863
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.
A group provided with an async function will now:
awaitwithin the group will still continue to be tagged with the group afterawaitreturns.The current AsyncContextTracker is only used for this and as such is directly changed in the
k6module. In the future there likely will be API so that multiple modules can use it simultaneously, but that seems way too involved to be included in this change and also currently onlygroupneeds this.fixes #2848 #2728