Panel JSON 配置示例
# 完整 Panel JSON 配置
以下是最终的 Panel JSON,可以导入 Grafana 直接复现 Demo:
{
"id": 1,
"type": "timeseries",
"title": "JVM Heap Committed (MB)",
"gridPos": {
"x": 0,
"y": 0,
"h": 10,
"w": 24
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineInterpolation": "linear",
"barAlignment": 0,
"barWidthFactor": 0.6,
"lineWidth": 2,
"fillOpacity": 12,
"gradientMode": "none",
"spanNulls": true,
"insertNulls": false,
"showPoints": "auto",
"pointSize": 5,
"stacking": {
"mode": "none",
"group": "A"
},
"axisPlacement": "auto",
"axisLabel": "",
"axisColorMode": "text",
"axisBorderShow": false,
"scaleDistribution": {
"type": "linear"
},
"axisCenteredZero": false,
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"thresholdsStyle": {
"mode": "off"
}
},
"color": {
"mode": "palette-classic"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "megabytes"
},
"overrides": []
},
"pluginVersion": "11.5.2",
"targets": [
{
"columns": [
{
"selector": "key",
"text": "Time",
"timestampFormat": "ms",
"type": "timestamp_epoch"
},
{
"selector": "value",
"text": "Heap Committed (MB)",
"type": "number"
}
],
"expression": "metrics[0].metrics ~> $each(function($v,$k){ {\"Time\": $k, \"Heap Committed (MB)\": $v} })",
"filters": [],
"format": "timeseries",
"global_query_id": "",
"parser": "backend",
"query_mode": "jsonata",
"refId": "A",
"root_selector": "metrics[0].metrics ~> $each(function($v, $k) {\n {\n \"key\": $k,\n \"value\": $v\n }\n})",
"source": "url",
"type": "json",
"url": "/ws/v1/timeline/metrics?metricNames=jvm.JvmMetrics.MemHeapCommittedM&appId=namenode&startTime=${__from}&endTime=${__to}",
"url_options": {
"data": "",
"method": "GET"
}
}
],
"datasource": {
"type": "yesoreyeram-infinity-datasource",
"uid": "fevqgogy2efi8a"
},
"options": {
"tooltip": {
"mode": "single",
"sort": "none",
"hideZeros": false
},
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
- 01
- [/metrics/metadata] — 元数据查询和使用 GET09-12
- 02
- [/metrics/metadata] — 请求完整链路解读09-12
- 03
- [/metrics/metadata] — 缓存数据装载 Phoenix09-12