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

Optional System Tags not passed to Influxdb and Default System Tags disabled #2668

Closed
perrinj3 opened this issue Aug 30, 2022 · 9 comments
Closed

Comments

@perrinj3
Copy link

Brief summary

When the System Tags vu and iter are specified in a K6 test either from the CLI or in the config.json the tags do not appear in the Influxdb output. Also specifying these tags completely disables all the default system tags.
If the output is a JSON file the optional system tags do appear as expected.

k6 version

v0.39

OS

windows

Docker version and image (if applicable)

No response

Steps to reproduce the problem

Specify system tags vu and iter in the config file like this
"systemTags": ["iter","vu"],

or from CLI like this
--system-tags vu --system-tags iter

run k6 with option
-- out influxdb=http://influxdb host

Expected behaviour

{"type":"Metric","data":{"name":"http_reqs","type":"counter","contains":"default","tainted":null,"thresholds":[],"submetrics":null},"metric":"http_reqs"}
{"type":"Point","data":{"time":"2022-08-30T15:09:27.2544213+10:00","value":1,"tags":{"type":"API Call","iter":"0","vu":"1","group":"Login","name":"name3","scenario":"Smoke Test1"}},"metric":"http_reqs"}
{"type":"Metric","data":{"name":"http_req_duration","type":"trend","contains":"time","tainted":null,"thresholds":[],"submetrics":null},"metric":"http_req_duration"}
{"type":"Point","data":{"time":"2022-08-30T15:09:27.2544213+10:00","value":2.0133,"tags":{"group":"Login","name":"name3","scenario":"Smoke Test1","type":"API Call","iter":"0","vu":"1"}},"metric":"http_req_duration"}
{"type":"Metric","data":{"name":"http_req_blocked","type":"trend","contains":"time","tainted":null,"thresholds":[],"submetrics":null},"metric":"http_req_blocked"}
{"type":"Point","data":{"time":"2022-08-30T15:09:27.2544213+10:00","value":2.9932,"tags":{"group":"Login","name":"name3","scenario":"Smoke Test1","type":"API Call","iter":"0","vu":"1"}},"metric":"http_req_blocked"}

Actual behaviour

optional system tags iter and vu do not appear as tags in the Influxdb output and the default system tags are all suppressed

@perrinj3 perrinj3 added the bug label Aug 30, 2022
@codebien
Copy link
Contributor

codebien commented Aug 30, 2022

Hi @perrinj3,
I have tried the latest version and it seems to me that it works as expected. How are you verifying your data points? Note that as the documentation is mentioning vu and iter are submitted by default as InfluxDB's fields.

For me, executing

k6 run  --system-tags vu,iter,url,name -o influxdb samples/http_get.js

returns the expected values on the influxdb server

> select * from http_reqs
name: http_reqs
time                iter name                    url                     value vu
----                ---- ----                    ---                     ----- --
1661856026596699962 0    https://test-api.k6.io/ https://test-api.k6.io/ 1     1

Also specifying these tags completely disables all the default system tags.

Regarding this part, it is the expected behaviour, it does not add the provided items on top instead the option sets the entire list.

I remove the bug label for now and I will wait for your updates.

@codebien codebien added awaiting user waiting for user to respond and removed bug labels Aug 30, 2022
@na--
Copy link
Member

na-- commented Sep 8, 2022

I'll close this, since it's the expected behavior and configurable via K6_INFLUXDB_TAGS_AS_FIELDS.

@na-- na-- closed this as completed Sep 8, 2022
@perrinj3
Copy link
Author

perrinj3 commented Sep 8, 2022

Thanks for this. I thought I had responded but it didn't update for some reason.
I can now see that this is expected behaviour for k6 to Influxdb
However if I output to OpenTelemetry using the InfluxDB receiver the vu and iter system tags are rejected. They seem to be passed as strings like this in the raw InfluxDB line protocol data sent to the collector
http_req_waiting,ip=52.70.134.36,ocsp_status=unknown,test=test iter="0",value=52.795516,vu="1" 1662145520898775240
http_req_receiving,ip=52.70.134.36,ocsp_status=unknown,test=test iter="0",value=0.246273,vu="1" 1662145520898775240

Refer to open-telemetry/opentelemetry-collector-contrib#13771 for more detail.
I'm not clear whether K6_INFLUXDB_TAGS_AS_FIELDS=vu:int,iter:int would help. I tried it but they still get rejected
Any ideas how I can work around this? I'm happy to open a new issue if that's the best thing to do

@na--
Copy link
Member

na-- commented Sep 8, 2022

Can you try to send them as tags, not as fields, by leaving the value empty? Like this K6_INFLUXDB_TAGS_AS_FIELDS=""

@perrinj3
Copy link
Author

perrinj3 commented Sep 8, 2022

That doesn't seem to make any difference. I can see them as tags in an outputted JSON file
{"type":"Point","data":{"time":"2022-09-08T18:48:44.7400702+10:00","value":3.9884,"tags":{"vu":"2","iter":"4"}},"metric":"iteration_duration"}
But opentel rejects vu and iter. Other system tags like status are passed through OpenTel ok

@na-- na-- reopened this Sep 8, 2022
@na-- na-- added help wanted evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Sep 8, 2022
@na--
Copy link
Member

na-- commented Sep 8, 2022

This JSON line is from the k6 json output, right? It is a completely different thing from the influxdb output and it's not affected by K6_INFLUXDB_TAGS_AS_FIELDS. To debug this, I suggest trying to dump the raw data that k6 sends to influx, e.g. by using something like mitmproxy.

@perrinj3
Copy link
Author

perrinj3 commented Sep 9, 2022

Thanks for that advice. I did look at the raw influxdb output using Fiddler and could see that the K6_INFLUXDB_TAGS_AS_FIELDS="" option did change the iter and vu tags from a string to a numeric. Opentelemetry then accepted the tags and passed them through.

@perrinj3 perrinj3 closed this as completed Sep 9, 2022
@na-- na-- added question docs ux and removed help wanted evaluation needed proposal needs to be validated or tested before fully implementing it in k6 awaiting user waiting for user to respond labels Sep 9, 2022
@perrinj3
Copy link
Author

perrinj3 commented Oct 11, 2022 via email

@na-- na-- reopened this Oct 13, 2022
@olegbespalov
Copy link
Contributor

At the time of writing, there is an xk6-output-opentelemetry extension is available and soonish we're planning to make it part of the k6 #2557

Closing the issue as not planned

@olegbespalov olegbespalov closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants