Skip to content

Refactor group() and check() tight coupling with the VU.State #2869

Closed

Description

@na--

This tight coupling is preventing us from implementing group() and check() purely in JavaScript. It is also preventing us from implementing similar functions, but with better UX (e.g. #1066, #2865) or that work better with async / await (#2848, #2728)

The tight coupling can be removed with only a very small loss of efficiency, by just having the MetricEngine process check and group_duration metrics as they appear and group them based on their group tag. Here is what basically needs to be removed:

k6/lib/vu_state.go

Lines 41 to 42 in 1d99b0b

// Current group; all emitted metrics are tagged with this.
Group *Group

k6/lib/runner.go

Lines 71 to 72 in 1d99b0b

// Returns the default (root) Group.
GetDefaultGroup() *Group

k6/js/modules/k6/k6.go

Lines 98 to 104 in 1d99b0b

g, err := state.Group.Group(name)
if err != nil {
return goja.Undefined(), err
}
old := state.Group
state.Group = g

check, err := state.Group.Check(name)

Activity

  1. self-assigned this
    on Apr 25, 2023
  2. added this to the v0.45.0 milestone on Apr 26, 2023
  3. modified the milestones: v0.45.0, v0.46.0 on May 31, 2023
  4. moved this to Short term - Q3 2023 in k6 open-source public roadmapon Jun 14, 2023
  5. modified the milestones: v0.46.0, v0.47.0 on Jul 31, 2023
  6. modified the milestones: v0.47.0, v0.48.0 on Sep 25, 2023
  7. removed this from the v0.48.0 milestone on Nov 16, 2023
  8. olegbespalov commented on Nov 16, 2023

    @olegbespalov
    Contributor

    For the record. After an internal discussion, we decided to clean a milestone since the issue was jumping between milestones without completion.

    Once we determine which milestone it lands, we set the right one.

  9. removed their assignment
    on May 9, 2024
  10. self-assigned this
    on May 21, 2024
  11. added this to the v0.52.0 milestone on May 21, 2024
  12. added a commit that references this issue on May 29, 2024
    39951ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions