api-requests.json 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {
  2. "uid": "briven-api-requests",
  3. "title": "api · requests",
  4. "tags": ["briven", "api"],
  5. "timezone": "browser",
  6. "schemaVersion": 39,
  7. "refresh": "30s",
  8. "time": { "from": "now-1h", "to": "now" },
  9. "panels": [
  10. {
  11. "id": 1,
  12. "title": "request rate (req/s)",
  13. "type": "timeseries",
  14. "datasource": { "type": "prometheus", "uid": "Prometheus" },
  15. "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
  16. "targets": [
  17. {
  18. "expr": "sum by (status) (rate(http_requests_total{service=\"api\"}[1m]))",
  19. "legendFormat": "{{status}}"
  20. }
  21. ]
  22. },
  23. {
  24. "id": 2,
  25. "title": "p99 latency (ms)",
  26. "type": "timeseries",
  27. "datasource": { "type": "prometheus", "uid": "Prometheus" },
  28. "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
  29. "targets": [
  30. {
  31. "expr": "histogram_quantile(0.99, sum by (le, route) (rate(http_request_duration_ms_bucket{service=\"api\"}[5m])))",
  32. "legendFormat": "{{route}}"
  33. }
  34. ]
  35. },
  36. {
  37. "id": 3,
  38. "title": "5xx error rate (%)",
  39. "type": "stat",
  40. "datasource": { "type": "prometheus", "uid": "Prometheus" },
  41. "gridPos": { "x": 0, "y": 8, "w": 12, "h": 4 },
  42. "targets": [
  43. {
  44. "expr": "100 * sum(rate(http_requests_total{service=\"api\",status=~\"5..\"}[5m])) / sum(rate(http_requests_total{service=\"api\"}[5m]))"
  45. }
  46. ],
  47. "fieldConfig": {
  48. "defaults": {
  49. "thresholds": {
  50. "steps": [
  51. { "value": 0, "color": "green" },
  52. { "value": 1, "color": "yellow" },
  53. { "value": 5, "color": "red" }
  54. ]
  55. },
  56. "unit": "percent"
  57. }
  58. }
  59. },
  60. {
  61. "id": 4,
  62. "title": "recent 5xx logs",
  63. "type": "logs",
  64. "datasource": { "type": "loki", "uid": "Loki" },
  65. "gridPos": { "x": 12, "y": 8, "w": 12, "h": 4 },
  66. "targets": [
  67. {
  68. "expr": "{service=\"api\", level=\"error\"}"
  69. }
  70. ]
  71. }
  72. ]
  73. }