k6 icon indicating copy to clipboard operation
k6 copied to clipboard

Tags for Virtual Users Not Output With the `k6.vus` Metric

Open davpate opened this issue 1 year ago • 2 comments

Brief summary

I'm running multiple scenarios with Virtual Users for my tests and trying to distinguish between the different scenarios that are starting up Virtual Users within my tests but I'm not able to get any additional Tags added to the VUs from what I can see.

k6 version

v0.53.0

OS

Amazon Linux 2

Docker version and image (if applicable)

No response

Steps to reproduce the problem

I've tried a few permutations based on what the docs say and none of them have worked so far.

Execution Tags

import http from 'k6/http';
import exec from 'k6/execution';

export default function () {
  exec.vu.metrics.tags['mytag'] = 'value1';
  exec.vu.metrics.tags['mytag2'] = 2;

  // the metrics these HTTP requests emit will get tagged with `mytag` and `mytag2`:
  http.batch(['https://test.k6.io', 'https://test-api.k6.io']);
}

Turning on System Tags for Scenario (each of my scenarios has a unique name, so including that with the k6.vus metric would help a ton here)

import http from 'k6/http';

export const options = {
  systemTags: ['scenario'],
};

export default function () {
  http.batch(['https://test.k6.io', 'https://test-api.k6.io']);
}

Expected behaviour

For the above scenarios, I'm expecting that k6.vus will be output with the Tags specified so that I can tell how many VUs are running for different scenarios and not have to split them apart as tests.

Actual behaviour

k6.vus tags don't appear to change from any of the above methods, even adding arbitrary values doesn't cause it to pass that Tag along when outputting k6.vus

davpate avatar Sep 16 '24 14:09 davpate