Does k6 support telegraf?

I am looking for some guidance that outline how I’d go about this for k6 > telegraf > influxdb > grafana workflow. My use case is that my current presentation infrastructure uses telegraph agent as a local endpoint to send data to the MSK (kafka) streaming platform for the downstream Influxdb + Grafana presentation layer to consume data from different sources. And I was required to go the same route for k6 data. So I cannot just use --K6_OUT=influxdb directly.
While I was browsing in the community forum about this topic, I saw some “conflicting” solutions.
I saw a response regarding using k6 with telegraf as “k6 doesn’t support telegraf”. On the other hand, I saw some recommendation to use telegraf to aggregate k6 metrics in another thread regarding how to minimize the size of the output data

Anyone has similar use case and could explain what is the best solution here? The claim about “Ignoring metrics is not possible with pure k6” in the how to minimize the size of the output data thread is still valid statement? And if using k6 with telegraf is possible, is there a use case and configuration example that I can refer? What output format of k6 result should be for further parsing/filtering on telegraf?

Hi @alex,

k6 doesn’t support telegraf

There is nothing for k6 to support really. Telegraf (among it many other features) can take in one format of metric data (for examples statsd) and output in another (for example influxdb).

As k6 supports both statsd and influxdb v1.8 and both of those are supported by telegraf - you can use telegraf with k6.

The exact configuration for your case is likely going to be better discussed with somebody more accustomed with telegraf instead of with k6.

You can find a fairly old comment of mine showcasing how to ignore metrics and submetrics using telegraf.

For your particular case I guess you will need to use the kafka output plugin and either influxdb or statsd input one for k6.

     -o statsd                       kafka output plugin
k6 ----------------> telegraf ---------------------------> kafka

But I have close to zero kafka experience.

You might also want to look at xk6-output-kafka although it might not have features you need and I am not certain there are many people who can help you with it :(.

Hope this helps you

p.s. k6 v0.42.0 comes out … this week and it will have experimental prometheus remote write support based on this extension. So depending on your timeframe you might be able to use it instead of influxdb or statsd.

1 Like

Hi @mstoykov,
Thank you for your explanation. A follow-up question about InfluxDB support. What about InfluxDB v2?

More or less Switch to the InfluxDB 2 Go client library · Issue #1730 · grafana/k6 · GitHub

1 Like