Skip to content

Commit 65b99d6

Browse files
feat(grafana_dashboard): enable datasource selection via templating (#10257)
This commit updates the Grafana dashboard configuration to include a datasource template variable. This allows users to dynamically select the datasource directly within the Grafana dashboard, improving flexibility and user experience.
1 parent 8ed3557 commit 65b99d6

File tree

2 files changed

+69
-29
lines changed

2 files changed

+69
-29
lines changed

cookbook/litellm_proxy_server/grafana_dashboard/dashboard_1/grafana_dashboard.json

+33-13
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
"datasource": {
3434
"type": "prometheus",
35-
"uid": "rMzWaBvIk"
35+
"uid": "${DS_PROMETHEUS}"
3636
},
3737
"fieldConfig": {
3838
"defaults": {
@@ -110,7 +110,7 @@
110110
{
111111
"datasource": {
112112
"type": "prometheus",
113-
"uid": "rMzWaBvIk"
113+
"uid": "${DS_PROMETHEUS}"
114114
},
115115
"editorMode": "code",
116116
"expr": "histogram_quantile(0.99, sum(rate(litellm_self_latency_bucket{self=\"self\"}[1m])) by (le))",
@@ -125,7 +125,7 @@
125125
{
126126
"datasource": {
127127
"type": "prometheus",
128-
"uid": "rMzWaBvIk"
128+
"uid": "${DS_PROMETHEUS}"
129129
},
130130
"fieldConfig": {
131131
"defaults": {
@@ -216,7 +216,7 @@
216216
{
217217
"datasource": {
218218
"type": "prometheus",
219-
"uid": "rMzWaBvIk"
219+
"uid": "${DS_PROMETHEUS}"
220220
},
221221
"editorMode": "code",
222222
"expr": "sum(increase(litellm_spend_metric_total[30d])) by (hashed_api_key)",
@@ -232,7 +232,7 @@
232232
{
233233
"datasource": {
234234
"type": "prometheus",
235-
"uid": "rMzWaBvIk"
235+
"uid": "${DS_PROMETHEUS}"
236236
},
237237
"fieldConfig": {
238238
"defaults": {
@@ -309,7 +309,7 @@
309309
{
310310
"datasource": {
311311
"type": "prometheus",
312-
"uid": "rMzWaBvIk"
312+
"uid": "${DS_PROMETHEUS}"
313313
},
314314
"editorMode": "code",
315315
"expr": "sum by (model) (increase(litellm_requests_metric_total[5m]))",
@@ -324,7 +324,7 @@
324324
{
325325
"datasource": {
326326
"type": "prometheus",
327-
"uid": "rMzWaBvIk"
327+
"uid": "${DS_PROMETHEUS}"
328328
},
329329
"fieldConfig": {
330330
"defaults": {
@@ -375,7 +375,7 @@
375375
{
376376
"datasource": {
377377
"type": "prometheus",
378-
"uid": "rMzWaBvIk"
378+
"uid": "${DS_PROMETHEUS}"
379379
},
380380
"editorMode": "code",
381381
"expr": "sum(increase(litellm_llm_api_failed_requests_metric_total[1h]))",
@@ -390,7 +390,7 @@
390390
{
391391
"datasource": {
392392
"type": "prometheus",
393-
"uid": "rMzWaBvIk"
393+
"uid": "${DS_PROMETHEUS}"
394394
},
395395
"fieldConfig": {
396396
"defaults": {
@@ -468,7 +468,7 @@
468468
{
469469
"datasource": {
470470
"type": "prometheus",
471-
"uid": "rMzWaBvIk"
471+
"uid": "${DS_PROMETHEUS}"
472472
},
473473
"editorMode": "code",
474474
"expr": "sum(increase(litellm_spend_metric_total[30d])) by (model)",
@@ -483,7 +483,7 @@
483483
{
484484
"datasource": {
485485
"type": "prometheus",
486-
"uid": "rMzWaBvIk"
486+
"uid": "${DS_PROMETHEUS}"
487487
},
488488
"fieldConfig": {
489489
"defaults": {
@@ -560,7 +560,7 @@
560560
{
561561
"datasource": {
562562
"type": "prometheus",
563-
"uid": "rMzWaBvIk"
563+
"uid": "${DS_PROMETHEUS}"
564564
},
565565
"editorMode": "code",
566566
"expr": "sum(increase(litellm_total_tokens_total[5m])) by (model)",
@@ -579,7 +579,27 @@
579579
"style": "dark",
580580
"tags": [],
581581
"templating": {
582-
"list": []
582+
"list": [
583+
{
584+
"current": {
585+
"selected": false,
586+
"text": "prometheus",
587+
"value": "edx8memhpd9tsa"
588+
},
589+
"hide": 0,
590+
"includeAll": false,
591+
"label": "datasource",
592+
"multi": false,
593+
"name": "DS_PROMETHEUS",
594+
"options": [],
595+
"query": "prometheus",
596+
"queryValue": "",
597+
"refresh": 1,
598+
"regex": "",
599+
"skipUrlSync": false,
600+
"type": "datasource"
601+
}
602+
]
583603
},
584604
"time": {
585605
"from": "now-1h",

cookbook/litellm_proxy_server/grafana_dashboard/dashboard_v2/grafana_dashboard.json

+36-16
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{
3838
"datasource": {
3939
"type": "prometheus",
40-
"uid": "bdiyc60dco54we"
40+
"uid": "${DS_PROMETHEUS}"
4141
},
4242
"description": "Total requests per second made to proxy - success + failure ",
4343
"fieldConfig": {
@@ -119,7 +119,7 @@
119119
{
120120
"datasource": {
121121
"type": "prometheus",
122-
"uid": "bdiyc60dco54we"
122+
"uid": "${DS_PROMETHEUS}"
123123
},
124124
"disableTextWrap": false,
125125
"editorMode": "code",
@@ -138,7 +138,7 @@
138138
{
139139
"datasource": {
140140
"type": "prometheus",
141-
"uid": "bdiyc60dco54we"
141+
"uid": "${DS_PROMETHEUS}"
142142
},
143143
"description": "Failures per second by Exception Class",
144144
"fieldConfig": {
@@ -220,7 +220,7 @@
220220
{
221221
"datasource": {
222222
"type": "prometheus",
223-
"uid": "bdiyc60dco54we"
223+
"uid": "${DS_PROMETHEUS}"
224224
},
225225
"disableTextWrap": false,
226226
"editorMode": "code",
@@ -239,7 +239,7 @@
239239
{
240240
"datasource": {
241241
"type": "prometheus",
242-
"uid": "bdiyc60dco54we"
242+
"uid": "${DS_PROMETHEUS}"
243243
},
244244
"description": "Average Response latency (seconds)",
245245
"fieldConfig": {
@@ -346,7 +346,7 @@
346346
{
347347
"datasource": {
348348
"type": "prometheus",
349-
"uid": "bdiyc60dco54we"
349+
"uid": "${DS_PROMETHEUS}"
350350
},
351351
"disableTextWrap": false,
352352
"editorMode": "code",
@@ -361,7 +361,7 @@
361361
{
362362
"datasource": {
363363
"type": "prometheus",
364-
"uid": "bdiyc60dco54we"
364+
"uid": "${DS_PROMETHEUS}"
365365
},
366366
"editorMode": "code",
367367
"expr": "histogram_quantile(0.5, sum(rate(litellm_request_total_latency_metric_bucket[2m])) by (le))",
@@ -391,7 +391,7 @@
391391
{
392392
"datasource": {
393393
"type": "prometheus",
394-
"uid": "bdiyc60dco54we"
394+
"uid": "${DS_PROMETHEUS}"
395395
},
396396
"description": "x-ratelimit-remaining-requests returning from LLM APIs",
397397
"fieldConfig": {
@@ -473,7 +473,7 @@
473473
{
474474
"datasource": {
475475
"type": "prometheus",
476-
"uid": "bdiyc60dco54we"
476+
"uid": "${DS_PROMETHEUS}"
477477
},
478478
"editorMode": "code",
479479
"expr": "topk(5, sort(litellm_remaining_requests))",
@@ -488,7 +488,7 @@
488488
{
489489
"datasource": {
490490
"type": "prometheus",
491-
"uid": "bdiyc60dco54we"
491+
"uid": "${DS_PROMETHEUS}"
492492
},
493493
"description": "x-ratelimit-remaining-tokens from LLM API ",
494494
"fieldConfig": {
@@ -570,7 +570,7 @@
570570
{
571571
"datasource": {
572572
"type": "prometheus",
573-
"uid": "bdiyc60dco54we"
573+
"uid": "${DS_PROMETHEUS}"
574574
},
575575
"editorMode": "code",
576576
"expr": "topk(5, sort(litellm_remaining_tokens))",
@@ -598,7 +598,7 @@
598598
{
599599
"datasource": {
600600
"type": "prometheus",
601-
"uid": "bdiyc60dco54we"
601+
"uid": "${DS_PROMETHEUS}"
602602
},
603603
"description": "Requests per second by Key Alias (keys are LiteLLM Virtual Keys). If key is None - means no Alias Set ",
604604
"fieldConfig": {
@@ -679,7 +679,7 @@
679679
{
680680
"datasource": {
681681
"type": "prometheus",
682-
"uid": "bdiyc60dco54we"
682+
"uid": "${DS_PROMETHEUS}"
683683
},
684684
"editorMode": "code",
685685
"expr": "sum(rate(litellm_proxy_total_requests_metric_total[2m])) by (api_key_alias)\n",
@@ -694,7 +694,7 @@
694694
{
695695
"datasource": {
696696
"type": "prometheus",
697-
"uid": "bdiyc60dco54we"
697+
"uid": "${DS_PROMETHEUS}"
698698
},
699699
"description": "Requests per second by Team Alias. If team is None - means no team alias Set ",
700700
"fieldConfig": {
@@ -775,7 +775,7 @@
775775
{
776776
"datasource": {
777777
"type": "prometheus",
778-
"uid": "bdiyc60dco54we"
778+
"uid": "${DS_PROMETHEUS}"
779779
},
780780
"editorMode": "code",
781781
"expr": "sum(rate(litellm_proxy_total_requests_metric_total[2m])) by (team_alias)\n",
@@ -792,7 +792,27 @@
792792
"schemaVersion": 40,
793793
"tags": [],
794794
"templating": {
795-
"list": []
795+
"list": [
796+
{
797+
"current": {
798+
"selected": false,
799+
"text": "prometheus",
800+
"value": "edx8memhpd9tsb"
801+
},
802+
"hide": 0,
803+
"includeAll": false,
804+
"label": "datasource",
805+
"multi": false,
806+
"name": "DS_PROMETHEUS",
807+
"options": [],
808+
"query": "prometheus",
809+
"queryValue": "",
810+
"refresh": 1,
811+
"regex": "",
812+
"skipUrlSync": false,
813+
"type": "datasource"
814+
}
815+
]
796816
},
797817
"time": {
798818
"from": "now-6h",

0 commit comments

Comments
 (0)