Prometheus doesn't report k6 metrics sending via experimental-prometheus-rw

Hi,
Has anyone tested the Prometheus integration with the experimental-prometheus-rw output flag? I spin up a fresh new Prometheus instance on my local with Brew with remote-write-receiver feature flag enabled, which was the only customization I did.
And I was using a really simple http get script to test this integration out. Below is the script:

import http from "k6/http"; 
export default function () { 
    http.get("[http://test.k6.io](http://test.k6.io/)"); 
}

I had this script running for 30 secs as there was a known issue with very short durations. I’ve run the test couple of times so far, however I didn’t see any k6-related metrics reporting to Prometheus by searching k6 key word on http://localhost:9090/metrics

❯ K6_PROMETHEUS_RW_SERVER_URL=http://127.0.0.1:9090/api/v1/write \
k6 run k6-http_get.js -d 30s -o experimental-prometheus-rw

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

  execution: local
     script: k6-http_get.js
     output: Prometheus remote write (http://127.0.0.1:9090/api/v1/write)

  scenarios: (100.00%) 1 scenario, 1 max VUs, 1m0s max duration (incl. graceful stop):
           * default: 1 looping VUs for 30s (gracefulStop: 30s)


running (0m30.0s), 0/1 VUs, 176 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  30s

     data_received..................: 2.1 MB 70 kB/s
     data_sent......................: 36 kB  1.2 kB/s
     http_req_blocked...............: avg=1.19ms   min=2µs      med=5µs      max=165.42ms p(90)=7µs      p(95)=7.44µs  
     http_req_connecting............: avg=615.97µs min=0s       med=0s       max=73ms     p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=84.04ms  min=69.78ms  med=73.14ms  max=449.4ms  p(90)=77.41ms  p(95)=108.8ms 
       { expected_response:true }...: avg=84.04ms  min=69.78ms  med=73.14ms  max=449.4ms  p(90)=77.41ms  p(95)=108.8ms 
     http_req_failed................: 0.00%  ✓ 0         ✗ 352
     http_req_receiving.............: avg=97.74µs  min=43µs     med=95µs     max=1.32ms   p(90)=130.9µs  p(95)=142.89µs
     http_req_sending...............: avg=23.59µs  min=10µs     med=23µs     max=240µs    p(90)=32µs     p(95)=36µs    
     http_req_tls_handshaking.......: avg=498.74µs min=0s       med=0s       max=93.63ms  p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=83.92ms  min=69.67ms  med=73ms     max=449.31ms p(90)=77.31ms  p(95)=108.66ms
     http_reqs......................: 352    11.720653/s
     iteration_duration.............: avg=170.62ms min=142.72ms med=145.77ms max=523.69ms p(90)=229.72ms p(95)=365.56ms
     iterations.....................: 176    5.860327/s
     vus............................: 1      min=1       max=1
     vus_max........................: 1      min=1       max=1

Sorry… This topic can be closed… The integration was actually working… I was just searching the k6 metrics at the wrong place (localhost:9090/metrics page). I thought every metric was supposed to be available on that page, but actually /metric is the metrics for Prometheus server itself…

1 Like

hi @alex

I’m happy to hear it’s solved and thanks for getting back here.

Cheers!