Some metrics does not reach InfluxDb

One additional issue you may be facing is by default, k6 passes vu to InfluxDB as a field instead of a tag. Fields are not treated the same way as tags when determining a unique time series in InfluxDB, so if metrics emitted by multiple users have the same timestamp, it is not enough to include vu in the --system-tags configuration. You must also remove it from the “tags as fields” configuration.

Currently, the only way I am aware of to do this is using the K6_INFLUXDB_TAGS_AS_FIELDS environment variable. The JSON configuration for this is broken, as I reported several months ago in the thread InfluxDB tagsAsFields configuration issues.

Of note, the default value for this env variable includes the iter, vu, and url tags, so to exclude vu, you would set the env variable as follows (using syntax appropriate for the OS/terminal used to execute your test scripts): K6_INFLUXDB_TAGS_AS_FIELDS=iter,url

I faced this issue with metrics for multiple users not being written to InfluxDB (using k6’s JSON output helped me confirm the timestamps were identical). Removing the vu tag from that environment variable did the trick for me. Hopefully it will work for you as well.

3 Likes