Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat(grafana_dashboard): enable datasource selection via templating (#10257)

minatoaquaMK265b99d6bc36f
diff --git a/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_1/grafana_dashboard.json b/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_1/grafana_dashboard.json
index 17fef1ffda5..269c1ea5a43 100644
--- a/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_1/grafana_dashboard.json
+++ b/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_1/grafana_dashboard.json
@@ -32,7 +32,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
@@ -110,7 +110,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.99, sum(rate(litellm_self_latency_bucket{self=\"self\"}[1m])) by (le))",
@@ -125,7 +125,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
@@ -216,7 +216,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(increase(litellm_spend_metric_total[30d])) by (hashed_api_key)",
@@ -232,7 +232,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
@@ -309,7 +309,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum by (model) (increase(litellm_requests_metric_total[5m]))",
@@ -324,7 +324,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
@@ -375,7 +375,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(increase(litellm_llm_api_failed_requests_metric_total[1h]))",
@@ -390,7 +390,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
@@ -468,7 +468,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(increase(litellm_spend_metric_total[30d])) by (model)",
@@ -483,7 +483,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
@@ -560,7 +560,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "rMzWaBvIk"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(increase(litellm_total_tokens_total[5m])) by (model)",
@@ -579,7 +579,27 @@
"style": "dark",
"tags": [],
"templating": {
- "list": []
+ "list": [
+ {
+ "current": {
+ "selected": false,
+ "text": "prometheus",
+ "value": "edx8memhpd9tsa"
+ },
+ "hide": 0,
+ "includeAll": false,
+ "label": "datasource",
+ "multi": false,
+ "name": "DS_PROMETHEUS",
+ "options": [],
+ "query": "prometheus",
+ "queryValue": "",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "type": "datasource"
+ }
+ ]
},
"time": {
"from": "now-1h",
diff --git a/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_v2/grafana_dashboard.json b/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_v2/grafana_dashboard.json
index 507a0b4a1a1..503364d8ff2 100644
--- a/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_v2/grafana_dashboard.json
+++ b/cookbook/litellm_proxy_server/grafana_dashboard/dashboard_v2/grafana_dashboard.json
@@ -37,7 +37,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "Total requests per second made to proxy - success + failure ",
"fieldConfig": {
@@ -119,7 +119,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"disableTextWrap": false,
"editorMode": "code",
@@ -138,7 +138,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "Failures per second by Exception Class",
"fieldConfig": {
@@ -220,7 +220,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"disableTextWrap": false,
"editorMode": "code",
@@ -239,7 +239,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "Average Response latency (seconds)",
"fieldConfig": {
@@ -346,7 +346,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"disableTextWrap": false,
"editorMode": "code",
@@ -361,7 +361,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.5, sum(rate(litellm_request_total_latency_metric_bucket[2m])) by (le))",
@@ -391,7 +391,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "x-ratelimit-remaining-requests returning from LLM APIs",
"fieldConfig": {
@@ -473,7 +473,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(5, sort(litellm_remaining_requests))",
@@ -488,7 +488,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "x-ratelimit-remaining-tokens from LLM API ",
"fieldConfig": {
@@ -570,7 +570,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(5, sort(litellm_remaining_tokens))",
@@ -598,7 +598,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "Requests per second by Key Alias (keys are LiteLLM Virtual Keys). If key is None - means no Alias Set ",
"fieldConfig": {
@@ -679,7 +679,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(rate(litellm_proxy_total_requests_metric_total[2m])) by (api_key_alias)\n",
@@ -694,7 +694,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"description": "Requests per second by Team Alias. If team is None - means no team alias Set ",
"fieldConfig": {
@@ -775,7 +775,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "bdiyc60dco54we"
+ "uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum(rate(litellm_proxy_total_requests_metric_total[2m])) by (team_alias)\n",
@@ -792,7 +792,27 @@
"schemaVersion": 40,
"tags": [],
"templating": {
- "list": []
+ "list": [
+ {
+ "current": {
+ "selected": false,
+ "text": "prometheus",
+ "value": "edx8memhpd9tsb"
+ },
+ "hide": 0,
+ "includeAll": false,
+ "label": "datasource",
+ "multi": false,
+ "name": "DS_PROMETHEUS",
+ "options": [],
+ "query": "prometheus",
+ "queryValue": "",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "type": "datasource"
+ }
+ ]
},
"time": {
"from": "now-6h",