k6

Calculating results from built-in metrics

I am creating monitoring system (k6+grafana+influxdb) with docker.

I want to use built-in metrics (not http-specific) to calculate some results, especially from data_received like data_received per request or group, but all I get in influxDB in data_received database are some timestamps with data_received values, however I don’t see a way to generate useful info from it.

Is it somehow possible to add tag to such metric, calculate it from json with jq or some other way?

Hi @riguwi,
I am not certain why you are getting only timestamps, maybe a problem with how you look at your data? There is a way to make tags into fields which is not that well documented but even with it you should still have some tags attached to all metrics.

But you can attach more:
For http requests (including data_received metric from those) you can add tags with the k6/http's method using params. It is important to note that for the http.get, there is no body argument, so the params are the second, not the third, argument as with the others.
If you are using websockets, see their documentation.

I suppose you can use a custom metric and are add some values if the built-in are not enough. If you take a look at the k6/metrics documentation and more specifically the example you will see that each and every time you add a data point you can add a tag for that datapoint, not the whole metric.

Additionally you can output to json with --out json or --out json=file.json and than use jq as shown, again in the documentation.