Skip to content

Commit 94eb399

Browse files
committed
metrics: support multiple k8s and tidb in grafana dashboards
Signed-off-by: just1900 <legendj228@gmail.com>
1 parent b607f34 commit 94eb399

File tree

1 file changed

+71
-27
lines changed

1 file changed

+71
-27
lines changed

metrics/grafana/binlog.json

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"steppedLine": false,
107107
"targets": [
108108
{
109-
"expr": "binlog_pump_storage_storage_size_bytes",
109+
"expr": "binlog_pump_storage_storage_size_bytes{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
110110
"format": "time_series",
111111
"hide": false,
112112
"intervalFactor": 2,
@@ -196,14 +196,14 @@
196196
"steppedLine": false,
197197
"targets": [
198198
{
199-
"expr": "binlog_pump_storage_gc_ts",
199+
"expr": "binlog_pump_storage_gc_ts{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
200200
"format": "time_series",
201201
"intervalFactor": 2,
202202
"legendFormat": "{{instance}} : gc_tso",
203203
"refId": "A"
204204
},
205205
{
206-
"expr": "binlog_pump_storage_max_commit_ts",
206+
"expr": "binlog_pump_storage_max_commit_ts{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
207207
"format": "time_series",
208208
"intervalFactor": 2,
209209
"legendFormat": "{{instance}} : max_commit_tso",
@@ -293,7 +293,7 @@
293293
"steppedLine": false,
294294
"targets": [
295295
{
296-
"expr": "rate(binlog_pump_rpc_duration_seconds_count{method=\"WriteBinlog\"}[1m])",
296+
"expr": "rate(binlog_pump_rpc_duration_seconds_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", method=\"WriteBinlog\"}[1m])",
297297
"format": "time_series",
298298
"intervalFactor": 2,
299299
"legendFormat": "{{instance}} :: {{label}}",
@@ -386,14 +386,14 @@
386386
"steppedLine": false,
387387
"targets": [
388388
{
389-
"expr": "histogram_quantile(0.99, rate(binlog_pump_rpc_duration_seconds_bucket{method=\"WriteBinlog\"}[1m]))",
389+
"expr": "histogram_quantile(0.99, rate(binlog_pump_rpc_duration_seconds_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", method=\"WriteBinlog\"}[1m]))",
390390
"format": "time_series",
391391
"intervalFactor": 2,
392392
"legendFormat": "{{instance}} : {{method}}:99",
393393
"refId": "A"
394394
},
395395
{
396-
"expr": "histogram_quantile(0.95, rate(binlog_pump_rpc_duration_seconds_bucket{method=\"WriteBinlog\"}[1m]))",
396+
"expr": "histogram_quantile(0.95, rate(binlog_pump_rpc_duration_seconds_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", method=\"WriteBinlog\"}[1m]))",
397397
"format": "time_series",
398398
"intervalFactor": 2,
399399
"legendFormat": "{{instance}} : {{method}} : 95",
@@ -481,14 +481,14 @@
481481
"steppedLine": false,
482482
"targets": [
483483
{
484-
"expr": "histogram_quantile(0.99, rate(binlog_pump_storage_write_binlog_size_bucket[1m]))",
484+
"expr": "histogram_quantile(0.99, rate(binlog_pump_storage_write_binlog_size_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}[1m]))",
485485
"format": "time_series",
486486
"intervalFactor": 2,
487487
"legendFormat": "{{instance}} : {{type}} : 99",
488488
"refId": "B"
489489
},
490490
{
491-
"expr": "histogram_quantile(0.95, rate(binlog_pump_storage_write_binlog_size_bucket[1m]))",
491+
"expr": "histogram_quantile(0.95, rate(binlog_pump_storage_write_binlog_size_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}[1m]))",
492492
"format": "time_series",
493493
"intervalFactor": 2,
494494
"legendFormat": "{{instance}} : {{type}} : 95",
@@ -578,14 +578,14 @@
578578
"steppedLine": false,
579579
"targets": [
580580
{
581-
"expr": "histogram_quantile(0.99, rate(binlog_pump_storage_write_binlog_duration_time_bucket[1m]))",
581+
"expr": "histogram_quantile(0.99, rate(binlog_pump_storage_write_binlog_duration_time_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}[1m]))",
582582
"format": "time_series",
583583
"intervalFactor": 2,
584584
"legendFormat": "{{instance}} : {{type}}:99",
585585
"refId": "A"
586586
},
587587
{
588-
"expr": "histogram_quantile(0.95, rate(binlog_pump_storage_write_binlog_duration_time_bucket[1m]))",
588+
"expr": "histogram_quantile(0.95, rate(binlog_pump_storage_write_binlog_duration_time_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}[1m]))",
589589
"format": "time_series",
590590
"intervalFactor": 2,
591591
"legendFormat": "{{instance}} : {{type}}:95",
@@ -673,7 +673,7 @@
673673
"steppedLine": false,
674674
"targets": [
675675
{
676-
"expr": "rate(binlog_pump_storage_error_count[1m])",
676+
"expr": "rate(binlog_pump_storage_error_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}[1m])",
677677
"format": "time_series",
678678
"instant": false,
679679
"intervalFactor": 2,
@@ -761,7 +761,7 @@
761761
"steppedLine": false,
762762
"targets": [
763763
{
764-
"expr": "binlog_pump_storage_query_tikv_count",
764+
"expr": "binlog_pump_storage_query_tikv_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
765765
"format": "time_series",
766766
"intervalFactor": 2,
767767
"legendFormat": "{{instance}}",
@@ -848,7 +848,7 @@
848848
"steppedLine": false,
849849
"targets": [
850850
{
851-
"expr": "tidb_server_critical_error_total",
851+
"expr": "tidb_server_critical_error_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
852852
"format": "time_series",
853853
"intervalFactor": 2,
854854
"legendFormat": "{{instance}}",
@@ -974,7 +974,7 @@
974974
"tableColumn": "__name__",
975975
"targets": [
976976
{
977-
"expr": "binlog_drainer_checkpoint_tso{instance = \"$drainer_instance\"}",
977+
"expr": "binlog_drainer_checkpoint_tso{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}",
978978
"format": "time_series",
979979
"instant": true,
980980
"intervalFactor": 2,
@@ -1039,7 +1039,7 @@
10391039
"steppedLine": false,
10401040
"targets": [
10411041
{
1042-
"expr": "binlog_drainer_pump_position{instance = \"$drainer_instance\"}",
1042+
"expr": "binlog_drainer_pump_position{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}",
10431043
"format": "time_series",
10441044
"hide": false,
10451045
"instant": false,
@@ -1127,7 +1127,7 @@
11271127
"steppedLine": false,
11281128
"targets": [
11291129
{
1130-
"expr": "sum(rate(binlog_drainer_read_binlog_size_count{instance = \"$drainer_instance\"}[1m])) by (nodeID)",
1130+
"expr": "sum(rate(binlog_drainer_read_binlog_size_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}[1m])) by (nodeID)",
11311131
"format": "time_series",
11321132
"intervalFactor": 2,
11331133
"legendFormat": "{{nodeID}}",
@@ -1215,7 +1215,7 @@
12151215
"steppedLine": false,
12161216
"targets": [
12171217
{
1218-
"expr": "histogram_quantile(0.95, rate(binlog_drainer_binlog_reach_duration_time_bucket{instance = \"$drainer_instance\"}[1m]))",
1218+
"expr": "histogram_quantile(0.95, rate(binlog_drainer_binlog_reach_duration_time_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}[1m]))",
12191219
"format": "time_series",
12201220
"intervalFactor": 2,
12211221
"legendFormat": "{{nodeID}}",
@@ -1303,7 +1303,7 @@
13031303
"steppedLine": false,
13041304
"targets": [
13051305
{
1306-
"expr": "binlog_drainer_error_count{instance = \"$drainer_instance\"}",
1306+
"expr": "binlog_drainer_error_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}",
13071307
"format": "time_series",
13081308
"intervalFactor": 2,
13091309
"legendFormat": "{{type}}",
@@ -1391,7 +1391,7 @@
13911391
"steppedLine": false,
13921392
"targets": [
13931393
{
1394-
"expr": "irate(binlog_drainer_event{instance = \"$drainer_instance\"}[1m])",
1394+
"expr": "irate(binlog_drainer_event{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}[1m])",
13951395
"format": "time_series",
13961396
"intervalFactor": 2,
13971397
"legendFormat": "{{type}}",
@@ -1477,7 +1477,7 @@
14771477
"steppedLine": false,
14781478
"targets": [
14791479
{
1480-
"expr": "histogram_quantile(0.99, rate(binlog_drainer_execute_duration_time_bucket{instance = \"$drainer_instance\"}[1m]))",
1480+
"expr": "histogram_quantile(0.99, rate(binlog_drainer_execute_duration_time_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}[1m]))",
14811481
"format": "time_series",
14821482
"intervalFactor": 2,
14831483
"legendFormat": "{{job}}",
@@ -1563,7 +1563,7 @@
15631563
"steppedLine": false,
15641564
"targets": [
15651565
{
1566-
"expr": "histogram_quantile(0.99, rate(binlog_drainer_query_duration_time_bucket{instance = \"$drainer_instance\"}[1m]))",
1566+
"expr": "histogram_quantile(0.99, rate(binlog_drainer_query_duration_time_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}[1m]))",
15671567
"format": "time_series",
15681568
"intervalFactor": 2,
15691569
"legendFormat": "{{type}}",
@@ -1651,7 +1651,7 @@
16511651
"steppedLine": false,
16521652
"targets": [
16531653
{
1654-
"expr": "histogram_quantile(0.95, rate(binlog_drainer_read_binlog_size_bucket{instance = \"$drainer_instance\"}[1m]))",
1654+
"expr": "histogram_quantile(0.95, rate(binlog_drainer_read_binlog_size_bucket{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}[1m]))",
16551655
"format": "time_series",
16561656
"intervalFactor": 2,
16571657
"legendFormat": "pump: {{nodeID}}",
@@ -1739,7 +1739,7 @@
17391739
"steppedLine": false,
17401740
"targets": [
17411741
{
1742-
"expr": "binlog_drainer_ddl_jobs_total{instance = \"$drainer_instance\"}",
1742+
"expr": "binlog_drainer_ddl_jobs_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}",
17431743
"format": "time_series",
17441744
"instant": false,
17451745
"intervalFactor": 2,
@@ -1823,7 +1823,7 @@
18231823
"steppedLine": false,
18241824
"targets": [
18251825
{
1826-
"expr": "binlog_drainer_queue_size{instance = \"$drainer_instance\"}",
1826+
"expr": "binlog_drainer_queue_size{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance = \"$drainer_instance\"}",
18271827
"format": "time_series",
18281828
"intervalFactor": 2,
18291829
"legendFormat": "{{name}}",
@@ -1923,7 +1923,7 @@
19231923
"steppedLine": false,
19241924
"targets": [
19251925
{
1926-
"expr": "go_goroutines{job=~\"binlog|pump|drainer\"}",
1926+
"expr": "go_goroutines{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", job=~\"binlog|pump|drainer\"}",
19271927
"format": "time_series",
19281928
"intervalFactor": 2,
19291929
"legendFormat": "{{instance}}",
@@ -2011,7 +2011,7 @@
20112011
"steppedLine": false,
20122012
"targets": [
20132013
{
2014-
"expr": "go_memstats_heap_inuse_bytes{job=~\"binlog|pump|drainer\"}",
2014+
"expr": "go_memstats_heap_inuse_bytes{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", job=~\"binlog|pump|drainer\"}",
20152015
"format": "time_series",
20162016
"intervalFactor": 2,
20172017
"legendFormat": "{{instance}}",
@@ -2069,6 +2069,50 @@
20692069
"tags": [],
20702070
"templating": {
20712071
"list": [
2072+
{
2073+
"allValue": null,
2074+
"current": {},
2075+
"datasource": "${DS_TEST-CLUSTER}",
2076+
"definition": "",
2077+
"hide": 0,
2078+
"includeAll": false,
2079+
"label": "K8s-cluster",
2080+
"multi": false,
2081+
"name": "k8s_cluster",
2082+
"options": [],
2083+
"query": "label_values(binlog_drainer_ddl_jobs_total, k8s_cluster)",
2084+
"refresh": 1,
2085+
"regex": "",
2086+
"skipUrlSync": false,
2087+
"sort": 0,
2088+
"tagValuesQuery": "",
2089+
"tags": [],
2090+
"tagsQuery": "",
2091+
"type": "query",
2092+
"useTags": false
2093+
},
2094+
{
2095+
"allValue": null,
2096+
"current": {},
2097+
"datasource": "${DS_TEST-CLUSTER}",
2098+
"definition": "",
2099+
"hide": 0,
2100+
"includeAll": false,
2101+
"label": "tidb_cluster",
2102+
"multi": false,
2103+
"name": "tidb_cluster",
2104+
"options": [],
2105+
"query": "label_values(binlog_drainer_ddl_jobs_total{k8s_cluster=\"$k8s_cluster\"}, tidb_cluster)",
2106+
"refresh": 1,
2107+
"regex": "",
2108+
"skipUrlSync": false,
2109+
"sort": 0,
2110+
"tagValuesQuery": "",
2111+
"tags": [],
2112+
"tagsQuery": "",
2113+
"type": "query",
2114+
"useTags": false
2115+
},
20722116
{
20732117
"allValue": null,
20742118
"current": {},
@@ -2080,7 +2124,7 @@
20802124
"multi": false,
20812125
"name": "drainer_instance",
20822126
"options": [],
2083-
"query": "label_values(binlog_drainer_ddl_jobs_total, instance)",
2127+
"query": "label_values(binlog_drainer_ddl_jobs_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}, instance)",
20842128
"refresh": 1,
20852129
"regex": "",
20862130
"skipUrlSync": false,

0 commit comments

Comments
 (0)