grafana / xk6-output-prometheus-remote

k6 extension to output real-time test metrics using Prometheus Remote Write.
GNU Affero General Public License v3.0
159 stars 72 forks source link

Headers and basic authentication #164

Open valleedelisle opened 6 months ago

valleedelisle commented 6 months ago

When we pass K6_PROMETHEUS_RW_PASSWORD/K6_PROMETHEUS_RW_USERNAME coupled with K6_PROMETHEUS_RW_HTTP_HEADERS, the latter will override the credentials. We need to pass a Authorization: Basic xxx header to authenticate.

bruce-42 commented 3 months ago

I can confirm that this problem still exists in k6 version v0.48.0 paired with xk6-output-remote v0.3.1 and the only work-around I have is to base64-encode the username:password and add that as one of the header key/values with Header name "Authorization" and value "Basic ". This is not a good work around for a number of reasons.

arukiidou commented 2 days ago

Is it enough to use this? https://pkg.go.dev/net/http#Request.SetBasicAuth