Skip to content

Instantly share code, notes, and snippets.

@initcron
Created May 12, 2025 08:46
Show Gist options
  • Save initcron/2dd5482c36bc9c2111e036fb70916249 to your computer and use it in GitHub Desktop.
Save initcron/2dd5482c36bc9c2111e036fb70916249 to your computer and use it in GitHub Desktop.
Import this as Grafana dashboard
{
"title": "FastAPI Prometheus Metrics Dashboard",
"timezone": "browser",
"refresh": "10s",
"schemaVersion": 30,
"version": 1,
"panels": [
{
"type": "timeseries",
"title": "Request Rate (Total)",
"targets": [
{
"expr": "sum(rate(http_requests_total[1m])) by (handler)",
"legendFormat": "{{handler}}",
"refId": "A"
}
],
"datasource": "Prometheus",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
}
},
{
"type": "timeseries",
"title": "Latency (95th Percentile)",
"targets": [
{
"expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[1m])) by (le, handler))",
"legendFormat": "{{handler}}",
"refId": "A"
}
],
"datasource": "Prometheus",
"gridPos": {
"x": 12,
"y": 0,
"w": 12,
"h": 8
}
},
{
"type": "timeseries",
"title": "Request Size (Bytes/sec)",
"targets": [
{
"expr": "rate(http_request_size_bytes_sum[1m])",
"legendFormat": "{{handler}}",
"refId": "A"
}
],
"datasource": "Prometheus",
"gridPos": {
"x": 0,
"y": 8,
"w": 12,
"h": 8
}
},
{
"type": "timeseries",
"title": "Response Size (Bytes/sec)",
"targets": [
{
"expr": "rate(http_response_size_bytes_sum[1m])",
"legendFormat": "{{handler}}",
"refId": "A"
}
],
"datasource": "Prometheus",
"gridPos": {
"x": 12,
"y": 8,
"w": 12,
"h": 8
}
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"type": "dashboard",
"name": "Annotations & Alerts",
"enable": true
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment