Hi @codebien
Happy holidays, at first
I have tried with a Mock server on my laptop as below:
Started mock server with mockserver -serverPort 80 -logLevel DEBUG
Then run K6 with following CLI command:
K6_PROMETHEUS_RW_SERVER_URL="http://localhost" K6_PROMETHEUS_RW_USERNAME=mimir K6_PROMETHEUS_RW_PASSWORD="password" K6_PROMETHEUS_RW_HTTP_HEADERS="X-Scope-OrgID:demo" k6 run -o experimental-prometheus-rw test_script.js
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: test_script.js
output: Prometheus remote write (http://localhost)
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0001] iter source=console
ERRO[0002] Failed to send the time series data to the endpoint error="got status code: 404 instead expected a 2xx successful status code" output="Prometheus remote write"
data_received..................: 33 kB 17 kB/s
data_sent......................: 1.3 kB 668 B/s
...
... Redacted for sake of shorter message
...
iterations.....................: 1 0.507468/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
running (00m02.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m02.0s/10m0s 1/1 iters, 1 per VU
On mockserver’s output I see:
2023-12-27 10:33:35 5.15.0 INFO 80 no expectation for:
{
"method" : "POST",
"path" : "/",
"headers" : {
"content-encoding" : [ "snappy" ],
"X-Scope-Orgid" : [ "demo" ],
"X-Prometheus-Remote-Write-Version" : [ "0.1.0" ],
"User-Agent" : [ "k6-prometheus-rw-output" ],
"Host" : [ "localhost" ],
"Content-Type" : [ "application/x-protobuf" ],
"Content-Length" : [ "935" ],
"Content-Encoding" : [ "snappy" ],
"Accept-Encoding" : [ "gzip" ]
},
"keepAlive" : true,
"secure" : false,
"protocol" : "HTTP_1_1",
"localAddress" : "[0:0:0:0:0:0:0:1]:80",
"remoteAddress" : "[0:0:0:0:0:0:0:1]:53709",
"body" : "Redacted for sake of shorter message"
}
returning response:
{
"statusCode" : 404,
"reasonPhrase" : "Not Found"
}
In the headers above, shouldn’t it be "X-Scope-Orgid" : "demo"
(without square brackets)?
In Mimir logs for grafana-agent rw requests, I see without square brackets…
Thanks
-Suleyman