LogQL: p95 request duration per route from log lines?
AdvancedProductionRapid-Fire PromQL & LogQL
Answer
quantile_over_time(0.95,
{app="checkout"} | json | __error__="" | unwrap duration_ms [5m]) by (route)
unwrap turns an extracted label into the sample value. Useful when the service has no histogram, but it scans every line, so convert it into a Loki recording rule or real metric if it becomes a dashboard staple.
More on Rapid-Fire PromQL & LogQL
Requests per second per service over the last 5 minutes?BeginnerPercentage of 5xx responses per service?Beginnerp99 latency per route from a histogram?IntermediateTop 5 pods by CPU usage in a namespace?BeginnerMemory working set as a percentage of the container limit?IntermediateWhich scrape targets are down right now?Beginner