Save non-string fields in InfluxDB

Can I submit a feature request to save non-string fields in InfluxDB, something like when the environment variable K6_INFLUXDB_TAGS_AS_INTEGER_FIELDS is defined, tags contained in the environment variable are saved as integer fields in InfluxDB?

I know currently k6 saves all additional tags as string fields and we have implemented our own webhook with conversion logic using InfluxDB subscription API. I would like to eliminate that code if possible.

Tami (Masaaki) Takamiya


this doesn’t sound unreasonable, though what is your use case? Since fields aren’t indexed and tags are, queries on fields would be very slow in comparison, so I’m not sure if it would be usable in a dashboard, for example.

And if this is added, we might want to consider something more flexible than the K6_INFLUXDB_TAGS_AS_INTEGER_FIELDS env var, to allow storing tags as other data types than integer.

I’m not sure if other k6 users would find this useful, but feel free to open a feature request on Github, and a PR is always welcome, of course :slight_smile:

Thanks for your response. Yes, I will open a feature request.

Our use case is as follows: We have an API that handles a transaction. One endpoint accepts transaction submission and another endpoint returns the status of a transaction. When a transaction status turned to ‘Complete’, the processing time in msec is also returned with the status. Those processing times are currently saved in InfluxDB as string data, but I want to save them as integer (or float) values in order to visualize them on Grafana.

Tami (Masaaki) Takamiya

I have submitted a pull request: Allow specifying data type to InfluxDB fields #1395 -

While I have changed the environment variable names to be used, the basic idea of saving non-string fields (Int/Float/Bool) is same. Please look at the pull request for details.

For the mean time the binary built from this forked source would be sufficient for our use, but hopefully it would be a part of the official releases. Thank you.

Tami (Masaaki) Takamiya