Hi! So we have such combo in our infrastructure:
k6.io → statsd_exporter → Prometheus → Grafana
And I’m trying to visualize these Trend-metrics:
- http_req_duration
- http_req_connecting
- http_req_tls_handshaking
- http_req_sending
- http_req_waiting
- http_req_receiving
using some sort of graph (e.g.: Graph (old) (type of panel in Grafana)):
I can see that statsd_exporter aggregate them in such way:
# HELP k6_http_req_duration Metric autogenerated by statsd_exporter.
# TYPE k6_http_req_duration summary
k6_http_req_duration{expected_response="true",group="::01. MethodName",method="POST",name="http://localhost:8080/api/methodName",project_name="ProjectName",proto="HTTP/1.1",scenario="default",status="200",quantile="0.5"} NaN
k6_http_req_duration{expected_response="true",group="::01. MethodName",method="POST",name="http://localhost:8080/api/methodName",project_name="ProjectName",proto="HTTP/1.1",scenario="default",status="200",quantile="0.9"} NaN
k6_http_req_duration{expected_response="true",group="::01. MethodName",method="POST",name="http://localhost:8080/api/methodName",project_name="ProjectName",proto="HTTP/1.1",scenario="default",status="200",quantile="0.99"} NaN
k6_http_req_duration_sum{expected_response="true",group="::01. MethodName",method="POST",name="http://localhost:8080/api/methodName",project_name="ProjectName",proto="HTTP/1.1",scenario="default",status="200"} 39.236463000000384
k6_http_req_duration_count{expected_response="true",group="::01. MethodName",method="POST",name="http://localhost:8080/api/methodName",project_name="ProjectName",proto="HTTP/1.1",scenario="default",status="200"} 56138
(note that there is no actual data in metrics with label “quantile”, though tests were launched quite recently)
I can’t quite understand how above metrics correlate with data printed out in console/terminal in the summary table at the end of the tests:
http_req_blocked....................: avg=3.4µs min=1µs med=3µs max=1.59ms p(90)=5µs p(95)=7µs
http_req_connecting.................: avg=1ns min=0s med=0s max=212µs p(90)=0s p(95)=0s
http_req_duration...................: avg=934.1µs min=224µs med=773µs max=585.33ms p(90)=1.38ms p(95)=1.8ms
{ expected_response:true }........: avg=934.1µs min=224µs med=773µs max=585.33ms p(90)=1.38ms p(95)=1.8ms
http_req_failed.....................: 0.00% ✓ 0 ✗ 141536
http_req_receiving..................: avg=94.73µs min=38µs med=75µs max=3.44ms p(90)=149µs p(95)=200µs
http_req_sending....................: avg=14.39µs min=5µs med=12µs max=1.19ms p(90)=20µs p(95)=26µs
http_req_tls_handshaking............: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting....................: avg=824.97µs min=166µs med=682µs max=585.2ms p(90)=1.22ms p(95)=1.57ms
And how could I correctly lay down these metrics into PromQL…
I’ve tried such queries:
# http_req_duration...................: avg=934.1µs min=224µs med=773µs max=585.33ms p(90)=1.38ms p(95)=1.8ms
avg(rate(k6_http_req_duration{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_duration{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_duration{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_duration{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_duration{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_duration{project_name="$project_name"}[$__rate_interval])) by (group)
# http_req_blocked....................: avg=3.4µs min=1µs med=3µs max=1.59ms p(90)=5µs p(95)=7µs
avg(rate(k6_http_req_blocked{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_blocked{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_blocked{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_blocked{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_blocked{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_blocked{project_name="$project_name"}[$__rate_interval])) by (group)
# http_req_connecting.................: avg=1ns min=0s med=0s max=212µs p(90)=0s p(95)=0s
avg(rate(k6_http_req_connecting{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_connecting{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_connecting{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_connecting{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_connecting{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_connecting{project_name="$project_name"}[$__rate_interval])) by (group)
# http_req_tls_handshaking............: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
avg(rate(k6_http_req_tls_handshaking{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_tls_handshaking{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_tls_handshaking{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_tls_handshaking{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_tls_handshaking{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_tls_handshaking{project_name="$project_name"}[$__rate_interval])) by (group)
# http_req_sending....................: avg=14.39µs min=5µs med=12µs max=1.19ms p(90)=20µs p(95)=26µs
avg(rate(k6_http_req_sending{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_sending{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_sending{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_sending{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_sending{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_sending{project_name="$project_name"}[$__rate_interval])) by (group)
# http_req_waiting....................: avg=824.97µs min=166µs med=682µs max=585.2ms p(90)=1.22ms p(95)=1.57ms
avg(rate(k6_http_req_waiting{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_waiting{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_waiting{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_waiting{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_waiting{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_waiting{project_name="$project_name"}[$__rate_interval])) by (group)
# http_req_receiving..................: avg=94.73µs min=38µs med=75µs max=3.44ms p(90)=149µs p(95)=200µs
avg(rate(k6_http_req_receiving{project_name="$project_name"}[$__rate_interval])) by (group)
min(rate(k6_http_req_receiving{project_name="$project_name"}[$__rate_interval])) by (group)
# med:
quantile(0.5, rate(k6_http_req_receiving{project_name="$project_name"}[$__rate_interval])) by (group)
max(rate(k6_http_req_receiving{project_name="$project_name"}[$__rate_interval])) by (group)
# p(90)
quantile(0.90, rate(k6_http_req_receiving{project_name="$project_name"}[$__rate_interval])) by (group)
# p(95)
quantile(0.95, rate(k6_http_req_receiving{project_name="$project_name"}[$__rate_interval])) by (group)
by (group)
- is a must have in our graphs, because we need to see statistics by each method/group/scenario (in our tests group represents each method of the API using this type of tests, where each describe function, well, describes each method call and corresponding checks)
But I’m not sure that those PromQL-queries actually correct…
It’l be great if you could point me to the right direction and to shed light upon these things