Sum rate
Calculate the rate of successful HTTP requests by method and route.
`otel-demo-metrics`:`http.server.request.duration`
| where `axiom.histogram` == "count"
| where `http.response.status_code` < 400
| align to 5m using prom::rate
| group by `http.request.method`, `http.route` using sum
Histogram
Calculate the 90th and 99th percentile HTTP request durations by service.
`otel-demo-metrics`:`http.server.request.duration`
| where `http.response.status_code` < 400
| bucket by `service.name` to 5m using interpolate_delta_histogram(0.90, 0.99)
Cumulative histogram
interpolate_cumulative_histogram works on histogram metrics using cumulative temporality. interpolate_delta_histogram works on histogram metrics using delta temporality.
`otel-demo-metrics`:`http.server.request.duration`
| where `http.response.status_code` < 400
| bucket by `http.request.method`, `http.route` to 5m using interpolate_cumulative_histogram(rate, 0.90, 0.99)
Compute
Compute error rate
Calculate the fraction of HTTP requests returning 5xx errors.
(
`otel-demo-metrics`:`http.server.request.duration`
| where status_code >= 500
| map interpolate::linear
| map rate
| align to 5m using avg
| group using sum,
`otel-demo-metrics`:`http.server.request.duration`
| map interpolate::linear
| map rate
| align to 5m using avg
| group using sum
)
| compute error_rate using /
Service Level Objectives (SLO)
SLO compliance over time
Calculate the fraction of time JVM CPU utilization across checkout and payment services stays below 80% over a 7-day window.
`otel-demo-metrics`:`jvm.cpu.recent_utilization`
| where `service.name` == #/checkout|payment/
| group using max
| map is::lt(0.8)
| align to 7d using avg
SLO histogram
Calculate the fraction of requests completing within the 400ms latency SLO target, measured weekly.
`otel-demo-metrics`:`http.server.request.duration`
| bucket to 5m using interpolate_delta_histogram(0.99)
| map is::lt(0.4)
| align to 7d using avg
Run in Playground