Defects for Counter and systemTags

Hello,
I have some bugs to report:

  1. systemTags option is ignored when specified in config file or exporting options. It does work when specifying as input parameter in the command line.
    2) Custom or built-in(checked only iterations) Counter metrics always report “value”:1 or whatever is in the “add” method to json or influxdb output. Works like a gauge… Not a defect.

Hi @VladT, thanks for reporting these. I’ve confirmed the first problem you mentioned and created a github issue for it here: systemTags is ignored when specified in the JS or JSON options · Issue #1010 · grafana/k6 · GitHub

Regarding the second issue, I can’t reproduce it. Can you give a short example that demonstrates it? I tried to run the example from the Counter.Add() docs page:

import { Counter } from "k6/metrics";

var myCounter = new Counter("my_counter");

export default function() {
  myCounter.add(1);
  myCounter.add(2, { tag1: "myValue", tag2: "myValue2" });
};

and running it with k6 run -i 2 -o json script.js produced:

    duration: -,  iterations: 2
         vus: 1, max: 1

{"type":"Metric","data":{"name":"iterations","type":"counter","contains":"default","tainted":null,"thresholds":[],"submetrics":null,"sub":{"name":"","parent":"","suffix":"","tags":null}},"metric":"iterations"}
{"type":"Point","data":{"time":"2019-04-25T09:24:46.273624191+03:00","value":1,"tags":null},"metric":"iterations"}
{"type":"Metric","data":{"name":"my_counter","type":"counter","contains":"default","tainted":null,"thresholds":[],"submetrics":null,"sub":{"name":"","parent":"","suffix":"","tags":null}},"metric":"my_counter"}
{"type":"Point","data":{"time":"2019-04-25T09:24:46.273595953+03:00","value":1,"tags":{"group":""}},"metric":"my_counter"}
{"type":"Point","data":{"time":"2019-04-25T09:24:46.273610488+03:00","value":2,"tags":{"group":"","tag1":"myValue","tag2":"myValue2"}},"metric":"my_counter"}
...
{"type":"Point","data":{"time":"2019-04-25T09:24:46.273681306+03:00","value":1,"tags":null},"metric":"iterations"}
{"type":"Point","data":{"time":"2019-04-25T09:24:46.273649443+03:00","value":1,"tags":{"group":""}},"metric":"my_counter"}
{"type":"Point","data":{"time":"2019-04-25T09:24:46.273676232+03:00","value":2,"tags":{"group":"","tag1":"myValue","tag2":"myValue2"}},"metric":"my_counter"}
...

    data_received........: 0 B 0 B/s
    data_sent............: 0 B 0 B/s
    iteration_duration...: avg=54.95µs min=37.94µs med=54.95µs max=71.96µs p(90)=68.56µs p(95)=70.26µs
    iterations...........: 2   0/s
    my_counter...........: 6   0/s
    vus..................: 1   min=1 max=1
    vus_max..............: 1   min=1 max=1

which is exactly what I’d expect to see - what am I missing? The built-in iterations metric emits only value: 1 because it is emitted after every iteration.

OK. I thought that Counter will emit the sum of all previously added values on each “add” call. Looks like the counter sum is calculated at the end of test. Thanks for clarifying.

Like if i call this
my_counter.add(1);
my_counter.add(1);
my_counter.add(1);
my_counter.add(2);

i would expect:
{“type”:“Point”,“data”:{“time”:““,“value”:1,…
{“type”:“Point”,“data”:{“time”:”
”,“value”:2,…
{“type”:“Point”,“data”:{“time”:““,“value”:3,…
{“type”:“Point”,“data”:{“time”:”
”,“value”:5,…