K6: There is no way to access vusMax from setup function

Created on 6 Oct 2020  路  4Comments  路  Source: loadimpact/k6

Environment

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

bug

Most helpful comment

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!

All 4 comments

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.

Sorry for causing you issues with that deprecation, unfortunately there wasn't a way to avoid making that breaking change to get scenarios... :disappointed: https://github.com/loadimpact/k6/issues/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).

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!

I'm on somewhat of a spree pruning and consolidating old k6 issues :sweat_smile: So I'm going to close this in favor of https://github.com/loadimpact/k6/issues/1320, where we already have a note about the specific problem (https://github.com/loadimpact/k6/issues/1320#issuecomment-704731921). 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 :tm: :sweat_smile: Hopefully in the next k6 release or the one after it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

na-- picture na--  路  3Comments

Julianhm9612 picture Julianhm9612  路  4Comments

caalle picture caalle  路  4Comments

na-- picture na--  路  3Comments

if-kenn picture if-kenn  路  4Comments