📝 BLOG.IK.AM

@making's memo
(🗃 Categories 🏷 Tags)

Spring Boot 2とMicrometerでPrometheusを使うときの便利PromQLメモ

🗃 {Programming/Java/org/springframework/boot}

🏷 Micrometer 🏷 Prometheus 🏷 Spring Boot

🗓 Updated at 2018-03-20T20:48:16+09:00 by Toshiaki Maki  🗓 Created at 2018-03-20T20:39:29+09:00 by Toshiaki Maki  {✒️️ Edit  ⏰ History}


⚠️ Caution: This content is a bit old. Please be careful to read.

メモ

次の設定がある前提。

management.metrics.distribution.percentiles-histogram.http.server.requests=true
management.metrics.distribution.sla.http.server.requests=100ms, 400ms, 500ms, 2000ms
management.metrics.distribution.percentiles.http.server.requests=0.5, 0.9, 0.95, 0.99, 0.999

Prometheusの場合、Client-side Percentilesの計算(management.metrics.distribution.percentiles)は不要であるが、
サーバーで計算するより速いし、ぱっと見るのに便利なので設定しておく。

各URIに対する90パーセンタイル

histogram_quantile(0.9, sum(rate(http_server_requests_seconds_bucket{status="200"}[5m])) by (app, uri, le))

image

特定のURIに対する各パーセンタイル

max(http_server_requests_seconds{uri="/entries/{entryId}", status="200", exception="none"}) by (quantile)

image

T=100msの場合の5min間隔のAppdex

Appdexについてはこちらを参照。

( sum(rate(http_server_requests_seconds_bucket{le="0.1", status="200"}[5m])) by (app, uri) + sum(rate(http_server_requests_seconds_bucket{le="0.4", status="200"}[5m])) by (app, uri) )
/ 2 / sum(rate(http_server_requests_seconds_count[5m])) by (app, uri)

image

T=500msの場合の5min間隔のAppdex

( sum(rate(http_server_requests_seconds_bucket{le="0.5", status="200"}[5m])) by (app, uri) + sum(rate(http_server_requests_seconds_bucket{le="2.0", status="200"}[5m])) by (app, uri) )
/ 2 / sum(rate(http_server_requests_seconds_count[5m])) by (app, uri)

image