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

There is no way to access vusMax from setup function #1656

Closed
VoloBro opened this issue Oct 6, 2020 · 4 comments
Closed

There is no way to access vusMax from setup function #1656

VoloBro opened this issue Oct 6, 2020 · 4 comments
Labels

Comments

@VoloBro
Copy link

VoloBro commented Oct 6, 2020

Environment

  • k6 version:0.28.0
  • OS and version:Linux
  • Docker version and image, if applicable: loadimpact/k6:0.28.0

Expected Behavior

We are on k6 version 0.26.2 and having trouble migrating to 0.28.0.
With new execution engine we no longer have access to options.vusMax that would allow us to prepare execution data for default function

export function setup() { console.log("vusMax", JSON.stringify(options.vusMax)); }

Actual Behavior

The variable is undefined now.

Steps to Reproduce the Problem

  1. Save following options in file options.json
{
  "summaryTrendStats": [
    "avg",
    "min",
    "med",
    "max",
    "p(90)",
    "p(95)",
    "p(99)",
    "p(99.9)"
  ],
  "stages": [
    {
      "duration": "1s",
      "target": 2
    },
    {
      "duration": "3s",
      "target": 2
    },
    {
      "duration": "1s",
      "target": 0
    }
  ],
  "rps": 2,
  "batchPerHost": 0
}
  1. Call vusMax inside setup function
export function setup() {
    console.log("vusMax", JSON.stringify(options.vusMax));
}
  1. Run the script
    k6 run --config options.json test.js

Actual: the variable is not available

@VoloBro VoloBro added the bug label Oct 6, 2020
@VoloBro VoloBro changed the title Is there a way to get a number of VU's Deprecated option vusMax Oct 6, 2020
@VoloBro
Copy link
Author

VoloBro commented Oct 6, 2020

As per version 0.27.0 vusMax option was deprecated

The vusMax / K6_VUS_MAX / -m / --max option is deprecated - it was previously used for the control of the initialized VUs by the REST API. Since that has now been restricted to the externally-controlled executor, the equivalent option there is called maxVUs.

But no alternative was given to access actual options from the script.

@VoloBro VoloBro changed the title Deprecated option vusMax There is no way to access vusMax from setup function Oct 6, 2020
@na--
Copy link
Member

na-- commented Oct 7, 2020

Sorry for causing you issues with that deprecation, unfortunately there wasn't a way to avoid making that breaking change to get scenarios... 😞 #1320 is the issue that you can follow for the new API.

For now, if you don't use any of the new complicated scenarios, it's easy to calculate MaxVUs yourself. If you use vus + duration, then maxVUs == vus. If you use stages, then maxVUs = max(stages.target).

@VoloBro
Copy link
Author

VoloBro commented Oct 7, 2020

Sorry for causing you issues with that deprecation, unfortunately there wasn't a way to avoid making that breaking change to get scenarios... 😞 #1320 is the issue that you can follow for the new API.

For now, if you don't use any of the new complicated scenarios, it's easy to calculate MaxVUs yourself. If you use vus + duration, then maxVUs == vus. If you use stages, then maxVUs = max(stages.target).

I totally love new k6 execution engine, you guys rock and addressed most of the stuff that came to my mind when I was using it.

Thank you again for your prompt reply and working on K6 improvements, looking forward to see new features!

@na--
Copy link
Member

na-- commented Jan 27, 2021

I'm on somewhat of a spree pruning and consolidating old k6 issues 😅 So I'm going to close this in favor of #1320, where we already have a note about the specific problem (#1320 (comment)). I can't give any promises on when we'll deliver it yet, but it's a high priority issue for us so it's going to be done... soon ™️ 😅 Hopefully in the next k6 release or the one after it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants