Issue with xk6 output Prometheus remote extension

I am facing issue with xk6 Prometheus remote extension. I have installed xk6 and tried to build the xk6 extension but unable to run my script ( I am running it in windows machine and “where xk6” commands gives a valid path). Getting an error like: K6_PROMETHEUS_REMOTE_URL=http://localhost:9090/api/v1/write : The term ‘K6_PROMETHEUS_REMOTE_URL=http://localhost:9090/api/v1/write’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.

Hi @Akshayini,
Welcome to the forum!

It seems to me that the issue here is with PowerShell rather than with Prometheus extension: is that what you’re using? Looking at this SO question, PowerShell simply doesn’t allow passing env vars in this way. I think it makes sense to try the workaround suggested in the above SO question. Otherwise, you could also try passing parameters in CLI or JSON. Here’s an example of CLI syntax:

 ./k6 run script.js --out output-prometheus-remote=url=http://localhost:9090/api/v1/write

I hope that helps :slightly_smiling_face:

Thanks a lot for the reply.

I am now able to pass the remote url through CLI syntax but now getting an error like “server returned HTTP status 404 Not Found: remote write receiver needs to be enabled with --enable-feature=remote-write-receiver”

Could you please tell how to enable this feature in prometheus? I have installed prometheus using helm.

Yes, you must pass that flag to Prometheus at the startup. In case of helm, it probably means overriding whatever arguments it passes by default. I think it makes sense to try to pass the flag with helm install command as it has --set arguments for that. The doc on configuring helm chart before installation may be of use as well.