Setup k6 to use InfluxDB v2

I have been able to use InfluxDB v1 successfully with K6. I’m trying to use InfluxDB v2, and followed a promising tutorial https://github.com/grafana/xk6-output-influxdb. After completing this I ran into issue, and do not know how to resolve it.


          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

ERRO[0000] invalid output type 'xk6-influxdb', available types are: cloud, csv, influxdb, json, statsd

This is the command I ran on the terminal

K6_INFLUXDB_ORGANIZATION=organization \
K6_INFLUXDB_BUCKET=newsample \
K6_INFLUXDB_TOKEN=<token> \
./k6 run -o xk6-influxdb=http://localhost:8086 sample.js

How do I resolve this issue?

Hi @ken4ward,
welcome back to the community forum :tada:

Apparently, you’re not using the xk6 binary built using the suggested command: xk6 build --with github.com/grafana/xk6-output-influxdb. Are you sure you’re running the local ./k6 run -o binary and not the global k6 run -o without extensions? Note the difference with the relative path.

Can you post the version you get if you run the ./k6 version command?

Hi there,
The k6 binary type can be different depending on the type of mac you are using, whether it has intel or apple processors. So it is best to build the k6 binary locally and target the test files