Table to display count of HTTP Statuses by endpoint and method

Hello,

We have collect a Prometheus counter called http_request_total. The counter has three labels, http_status (e.g. 200, 300, 400, 500), endpoint (e.g. /people/ryan), and method (e.g. GET, POST). I’m trying to create a dashboard that can easily show me the number of 200s, 300s, 400s, and 500s per method and endpoint. I thought that the Table panel would be the best to display this information, but I’m struggling to get everything to work. I’d like the table to look like the following:

endpoint method 200s 300s 400s 500s
/users POST 1000 5 7 10
/users GET 5000 0 0 0

The time range that was being queried would be controlled by the Grafana UI (e.g. a “Quick Range” like “Last 1 hour”). Is this possible?

So far, the best I’ve been able to do is to get a single HTTP status to aggregate per table using:

  • Metrics
    • Query: sum(web_api_requests_total{http_status=~“2…”}) by (endpoint, method)
    • Legend format: {{endpoint}} {{method}}
    • Format as: Time Series
  • Options:
    • Table Transform: Time series aggregation
    • Columns: Total

That gives me a table that looks like:

Metric Total
/users POST 1000
/users GET 5000

Does anyone have any suggestions on how best to display a sum of HTTP status codes over the given time period by endpoint and method?

Thanks,
Ryan

Did you get a help or suggestions for this?