Skip to content

Commit 1305b91

Browse files
schmikeiv-zhuravlev
authored andcommitted
cleanup
1 parent df89c66 commit 1305b91

13 files changed

+417
-324
lines changed

clickhouse-mixin/config.libsonnet

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
11
{
2+
// Enable multi-cluster mode to use cluster-based filtering
23
enableMultiCluster: false,
3-
filteringSelector: 'job=~".*/clickhouse.*"',
4-
groupLabels: if self.enableMultiCluster then ["job", "cluster"] else ["job"],
5-
instanceLabels: ["instance"],
6-
dashboardTags: ["clickhouse-mixin"],
7-
uid: "clickhouse",
8-
dashboardNamePrefix: "ClickHouse",
9-
10-
// additional params
11-
dashboardPeriod: "now-30m",
12-
dashboardTimezone: "default",
13-
dashboardRefresh: "1m",
144

5+
// Base filtering selector that's always applied
6+
filteringSelector: 'job="integrations/clickhouse"',
7+
8+
// Labels used for grouping and filtering
9+
groupLabels: if self.enableMultiCluster then ['instance', 'cluster'] else ['instance'],
10+
11+
// Labels that represent instances (used for single instance mode)
12+
instanceLabels: ['instance'],
13+
14+
// Labels that should be treated as pure instance labels (no multi-select in single instance mode)
15+
pureInstanceLabels: ['instance'],
16+
17+
// Dashboard configuration
18+
dashboardTags: ['clickhouse-mixin'],
19+
uid: 'clickhouse',
20+
dashboardNamePrefix: 'ClickHouse',
21+
dashboardPeriod: 'now-30m',
22+
dashboardTimezone: 'default',
23+
dashboardRefresh: '1m',
24+
25+
// Legend configuration
26+
legendLabels: ['instance'],
27+
28+
// Logging configuration
1529
enableLokiLogs: true,
16-
logLabels: if self.enableMultiCluster then ["job", "instance", "cluster", "level"] else ["job", "instance", "level"],
30+
logLabels: if self.enableMultiCluster then ['instance', 'cluster', 'level'] else ['instance', 'level'],
1731
extraLogLabels: [], // Required by logs-lib
18-
logsVolumeGroupBy: "level",
32+
logsVolumeGroupBy: 'level',
1933
showLogsVolume: true,
2034

21-
// alerts params
22-
alertsReplicasMaxQueueSize: "99",
35+
// Alerts configuration
36+
alertsReplicasMaxQueueSize: '99',
2337
}

clickhouse-mixin/dashboards.libsonnet

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
local g = import "./g.libsonnet";
2-
local logslib = import "logs-lib/logs/main.libsonnet";
1+
local g = import './g.libsonnet';
2+
local logslib = import 'logs-lib/logs/main.libsonnet';
33
{
44
local root = self,
55
new(this)::
@@ -15,24 +15,24 @@ local logslib = import "logs-lib/logs/main.libsonnet";
1515
local panels = this.grafana.panels;
1616

1717
{
18-
"clickhouse-replica":
19-
g.dashboard.new(prefix + " replica")
18+
'clickhouse-replica':
19+
g.dashboard.new(prefix + ' replica')
2020
+ g.dashboard.withPanels(
2121
g.util.grid.wrapPanels(
2222
[
23-
panels.interserverConnectionsPanel,
24-
panels.replicaQueueSizePanel,
25-
panels.replicaOperationsPanel,
26-
panels.replicaReadOnlyPanel,
27-
panels.zooKeeperWatchesPanel,
28-
panels.zooKeeperSessionsPanel,
29-
panels.zooKeeperRequestsPanel,
23+
panels.interserverConnectionsPanel { gridPos+: { w: 12 } },
24+
panels.replicaQueueSizePanel { gridPos+: { w: 12 } },
25+
panels.replicaOperationsPanel { gridPos+: { w: 12 } },
26+
panels.replicaReadOnlyPanel { gridPos+: { w: 12 } },
27+
panels.zooKeeperWatchesPanel { gridPos+: { w: 12 } },
28+
panels.zooKeeperSessionsPanel { gridPos+: { w: 12 } },
29+
panels.zooKeeperRequestsPanel { gridPos+: { w: 24 } },
3030
]
3131
)
3232
)
3333
+ root.applyCommon(
3434
vars.singleInstance,
35-
uid + "_clickhouse_replica",
35+
uid + '_clickhouse_replica',
3636
tags,
3737
links { clickhouseReplica+:: {} },
3838
annotations,
@@ -41,25 +41,25 @@ local logslib = import "logs-lib/logs/main.libsonnet";
4141
period
4242
),
4343

44-
"clickhouse-overview":
45-
g.dashboard.new(prefix + " overview")
44+
'clickhouse-overview':
45+
g.dashboard.new(prefix + ' overview')
4646
+ g.dashboard.withPanels(
4747
g.util.grid.wrapPanels(
4848
[
49-
panels.successfulQueriesPanel,
50-
panels.failedQueriesPanel,
51-
panels.rejectedInsertsPanel,
52-
panels.memoryUsagePanel,
53-
panels.memoryUsageGaugePanel,
54-
panels.activeConnectionsPanel,
55-
panels.networkReceivedPanel,
56-
panels.networkTransmittedPanel,
49+
panels.successfulQueriesPanel { gridPos+: { w: 24 } },
50+
panels.failedQueriesPanel { gridPos+: { w: 12 } },
51+
panels.rejectedInsertsPanel { gridPos+: { w: 12 } },
52+
panels.memoryUsagePanel { gridPos+: { w: 12 } },
53+
panels.memoryUsageGaugePanel { gridPos+: { w: 12 } },
54+
panels.activeConnectionsPanel { gridPos+: { w: 24 } },
55+
panels.networkReceivedPanel { gridPos+: { w: 12 } },
56+
panels.networkTransmittedPanel { gridPos+: { w: 12 } },
5757
]
5858
)
5959
)
6060
+ root.applyCommon(
6161
vars.singleInstance,
62-
uid + "_clickhouse_overview",
62+
uid + '_clickhouse_overview',
6363
tags,
6464
links { clickhouseOverview+:: {} },
6565
annotations,
@@ -68,22 +68,22 @@ local logslib = import "logs-lib/logs/main.libsonnet";
6868
period
6969
),
7070

71-
"clickhouse-latency":
72-
g.dashboard.new(prefix + " latency")
71+
'clickhouse-latency':
72+
g.dashboard.new(prefix + ' latency')
7373
+ g.dashboard.withPanels(
7474
g.util.grid.wrapPanels(
7575
[
76-
panels.diskReadLatencyPanel,
77-
panels.diskWriteLatencyPanel,
78-
panels.networkTransmitLatencyInboundPanel,
79-
panels.networkTransmitLatencyOutboundPanel,
80-
panels.zooKeeperWaitTimePanel,
76+
panels.diskReadLatencyPanel { gridPos+: { w: 12 } },
77+
panels.diskWriteLatencyPanel { gridPos+: { w: 12 } },
78+
panels.networkTransmitLatencyInboundPanel { gridPos+: { w: 12 } },
79+
panels.networkTransmitLatencyOutboundPanel { gridPos+: { w: 12 } },
80+
panels.zooKeeperWaitTimePanel { gridPos+: { w: 24 } },
8181
]
8282
)
8383
)
8484
+ root.applyCommon(
8585
vars.singleInstance,
86-
uid + "_clickhouse_latency",
86+
uid + '_clickhouse_latency',
8787
tags,
8888
links { clickhouseLatency+:: {} },
8989
annotations,
@@ -96,9 +96,9 @@ local logslib = import "logs-lib/logs/main.libsonnet";
9696
+
9797
if this.config.enableLokiLogs then
9898
{
99-
"clickhouse-logs":
99+
logs:
100100
logslib.new(
101-
prefix + " logs",
101+
prefix + ' logs',
102102
datasourceName=this.grafana.variables.datasources.loki.name,
103103
datasourceRegex=this.grafana.variables.datasources.loki.regex,
104104
filterSelector=this.config.filteringSelector,
@@ -111,7 +111,7 @@ local logslib = import "logs-lib/logs/main.libsonnet";
111111
{
112112
logs+:
113113
// reference to self, already generated variables, to keep them, but apply other common data in applyCommon
114-
root.applyCommon(super.logs.templating.list, uid=uid + "-logs", tags=tags, links=links { logs+:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period),
114+
root.applyCommon(super.logs.templating.list, uid=uid + '-logs', tags=tags, links=links { logs+:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period),
115115
},
116116
panels+:
117117
{

clickhouse-mixin/dashboards_out/clickhouse-latency

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
"gridPos": {
5656
"h": 8,
57-
"w": 8,
57+
"w": 12,
5858
"x": 0,
5959
"y": 0
6060
},
@@ -76,8 +76,9 @@
7676
"type": "prometheus",
7777
"uid": "${prometheus_datasource}"
7878
},
79-
"expr": "increase(ClickHouseProfileEvents_DiskReadElapsedMicroseconds{job=~\"$job\",instance=~\"$instance\",test=~\"$test\"}[$__rate_interval])",
80-
"legendFormat": "{{job}} - {{instance}}"
79+
"expr": "increase(ClickHouseProfileEvents_DiskReadElapsedMicroseconds{instance=~\"$instance\",job=~\"$job\"}[$__rate_interval])",
80+
"interval": "30s",
81+
"legendFormat": "{{instance}} - disk read elapsed"
8182
}
8283
],
8384
"title": "Disk read latency",
@@ -104,8 +105,8 @@
104105
},
105106
"gridPos": {
106107
"h": 8,
107-
"w": 8,
108-
"x": 8,
108+
"w": 12,
109+
"x": 12,
109110
"y": 0
110111
},
111112
"id": 2,
@@ -126,8 +127,9 @@
126127
"type": "prometheus",
127128
"uid": "${prometheus_datasource}"
128129
},
129-
"expr": "increase(ClickHouseProfileEvents_DiskWriteElapsedMicroseconds{job=~\"$job\",instance=~\"$instance\",test=~\"$test\"}[$__rate_interval])",
130-
"legendFormat": "{{job}} - {{instance}}"
130+
"expr": "increase(ClickHouseProfileEvents_DiskWriteElapsedMicroseconds{instance=~\"$instance\",job=~\"$job\"}[$__rate_interval])",
131+
"interval": "30s",
132+
"legendFormat": "{{instance}} - disk write elapsed"
131133
}
132134
],
133135
"title": "Disk write latency",
@@ -154,9 +156,9 @@
154156
},
155157
"gridPos": {
156158
"h": 8,
157-
"w": 8,
158-
"x": 16,
159-
"y": 0
159+
"w": 12,
160+
"x": 0,
161+
"y": 8
160162
},
161163
"id": 3,
162164
"options": {
@@ -176,8 +178,9 @@
176178
"type": "prometheus",
177179
"uid": "${prometheus_datasource}"
178180
},
179-
"expr": "increase(ClickHouseProfileEvents_NetworkReceiveElapsedMicroseconds{job=~\"$job\",instance=~\"$instance\",test=~\"$test\"}[$__rate_interval])",
180-
"legendFormat": "{{job}} - {{instance}}"
181+
"expr": "increase(ClickHouseProfileEvents_NetworkReceiveElapsedMicroseconds{instance=~\"$instance\",job=~\"$job\"}[$__rate_interval])",
182+
"interval": "30s",
183+
"legendFormat": "{{instance}} - network receive elapsed"
181184
}
182185
],
183186
"title": "Network receive latency",
@@ -204,8 +207,8 @@
204207
},
205208
"gridPos": {
206209
"h": 8,
207-
"w": 8,
208-
"x": 0,
210+
"w": 12,
211+
"x": 12,
209212
"y": 8
210213
},
211214
"id": 4,
@@ -226,8 +229,9 @@
226229
"type": "prometheus",
227230
"uid": "${prometheus_datasource}"
228231
},
229-
"expr": "increase(ClickHouseProfileEvents_NetworkSendElapsedMicroseconds{job=~\"$job\",instance=~\"$instance\",test=~\"$test\"}[$__rate_interval])",
230-
"legendFormat": "{{job}} - {{instance}}"
232+
"expr": "increase(ClickHouseProfileEvents_NetworkSendElapsedMicroseconds{instance=~\"$instance\",job=~\"$job\"}[$__rate_interval])",
233+
"interval": "30s",
234+
"legendFormat": "{{instance}} - network send elapsed"
231235
}
232236
],
233237
"title": "Network transmit latency",
@@ -254,9 +258,9 @@
254258
},
255259
"gridPos": {
256260
"h": 8,
257-
"w": 8,
258-
"x": 8,
259-
"y": 8
261+
"w": 24,
262+
"x": 0,
263+
"y": 16
260264
},
261265
"id": 5,
262266
"options": {
@@ -276,8 +280,9 @@
276280
"type": "prometheus",
277281
"uid": "${prometheus_datasource}"
278282
},
279-
"expr": "increase(ClickHouseProfileEvents_ZooKeeperWaitMicroseconds{job=~\"$job\",instance=~\"$instance\",test=~\"$test\"}[$__rate_interval])",
280-
"legendFormat": "{{job}} - {{instance}}"
283+
"expr": "increase(ClickHouseProfileEvents_ZooKeeperWaitMicroseconds{instance=~\"$instance\",job=~\"$job\"}[$__rate_interval])",
284+
"interval": "30s",
285+
"legendFormat": "{{instance}} - ZooKeeper wait"
281286
}
282287
],
283288
"title": "ZooKeeper wait time",
@@ -304,29 +309,22 @@
304309
"type": "prometheus",
305310
"uid": "${prometheus_datasource}"
306311
},
307-
"includeAll": true,
308-
"label": "Job",
309-
"multi": true,
310-
"name": "job",
311-
"query": "label_values(ClickHouseMetrics_InterserverConnection{job=~\"integrations/mixin\"}, job)",
312-
"refresh": 2,
313-
"sort": 1,
314-
"type": "query"
315-
},
316-
{
317-
"allValue": ".+",
318-
"datasource": {
319-
"type": "prometheus",
320-
"uid": "${prometheus_datasource}"
321-
},
322-
"includeAll": true,
312+
"includeAll": false,
323313
"label": "Instance",
324-
"multi": true,
314+
"multi": false,
325315
"name": "instance",
326-
"query": "label_values(ClickHouseMetrics_InterserverConnection{job=~\"integrations/mixin\",job=~\"$job\"}, instance)",
316+
"query": "label_values(ClickHouseMetrics_InterserverConnection{job=~\"$job\"}, instance)",
327317
"refresh": 2,
328318
"sort": 1,
329319
"type": "query"
320+
},
321+
{
322+
"hide": 2,
323+
"label": "Loki data source",
324+
"name": "loki_datasource",
325+
"query": "loki",
326+
"regex": "",
327+
"type": "datasource"
330328
}
331329
]
332330
},

0 commit comments

Comments
 (0)