k6

How to set the Tag CLI flag

Hi,

After referencing the options and tagging documentation I’m still having trouble setting a test wide tag using the CLI flag. I confirmed I can do it when setting it via the exported script options, like so:

image

However when I attempt to include it in my CLI command, like so:

k6 run --tag deploymentId:1.0 --out=influxdb=MyInfluxDBInstance myScript.js

I receive the following error message:

tag 0: Invalid tag, empty value

Any assistance is greatly appreciated.

Thanks!

Ryan

Hi @Rylang,
The correct syntax for setting tags is name=value not name:value.
so in your case :
k6 run --tag deploymentId=1.0 --out=influxdb=MyInfluxDBInstance myScript.js

We have apparently mistakenly written it with : in the docs (fixed now), but it is correctly referenced in the cli help

$ k6 run --help | grep -- --tag
      --tag tag                           add a tag to be applied to all samples, as `[name]=[value]`

Thanks for pointing this out, and sorry for the mistake :slightly_frowning_face:

Thanks @mstoykov,

That did the trick - appreciate the quick reply!

1 Like