@@ -8,7 +8,7 @@ local dashboardUid = 'couchdb-nodes';
8
8
9
9
local promDatasourceName = 'prometheus_datasource' ;
10
10
local lokiDatasourceName = 'loki_datasource' ;
11
- local matcher = 'job=~"$job" , couchdb_cluster=~"$couchdb_cluster", instance=~"$instance"' ;
11
+ local getMatcher(cfg) = '%(couchDBSelector)s , couchdb_cluster=~"$couchdb_cluster", instance=~"$instance"' % cfg ;
12
12
13
13
local promDatasource = {
14
14
uid: '${%s}' % promDatasourceName,
@@ -18,11 +18,11 @@ local lokiDatasource = {
18
18
uid: '${%s}' % lokiDatasourceName,
19
19
};
20
20
21
- local erlangMemoryUsagePanel = {
21
+ local erlangMemoryUsagePanel(cfg) = {
22
22
datasource: promDatasource,
23
23
targets: [
24
24
prometheus.target(
25
- 'couchdb_erlang_memory_bytes{' + matcher + ', memory_type="total"}' ,
25
+ 'couchdb_erlang_memory_bytes{' + getMatcher(cfg) + ', memory_type="total"}' ,
26
26
datasource=promDatasource,
27
27
legendFormat='{{instance}}' ,
28
28
),
@@ -97,11 +97,11 @@ local erlangMemoryUsagePanel = {
97
97
},
98
98
};
99
99
100
- local openOSFilesPanel = {
100
+ local openOSFilesPanel(cfg) = {
101
101
datasource: promDatasource,
102
102
targets: [
103
103
prometheus.target(
104
- 'couchdb_open_os_files_total{' + matcher + '}' ,
104
+ 'couchdb_open_os_files_total{' + getMatcher(cfg) + '}' ,
105
105
datasource=promDatasource,
106
106
legendFormat='{{instance}}' ,
107
107
),
@@ -172,11 +172,11 @@ local openOSFilesPanel = {
172
172
},
173
173
};
174
174
175
- local openDatabasesPanel = {
175
+ local openDatabasesPanel(cfg) = {
176
176
datasource: promDatasource,
177
177
targets: [
178
178
prometheus.target(
179
- 'couchdb_open_databases_total{' + matcher + '}' ,
179
+ 'couchdb_open_databases_total{' + getMatcher(cfg) + '}' ,
180
180
datasource=promDatasource,
181
181
legendFormat='{{instance}}' ,
182
182
),
@@ -250,11 +250,11 @@ local openDatabasesPanel = {
250
250
},
251
251
};
252
252
253
- local databaseWritesPanel = {
253
+ local databaseWritesPanel(cfg) = {
254
254
datasource: promDatasource,
255
255
targets: [
256
256
prometheus.target(
257
- 'rate(couchdb_database_writes_total{' + matcher + '}[$__rate_interval])' ,
257
+ 'rate(couchdb_database_writes_total{' + getMatcher(cfg) + '}[$__rate_interval])' ,
258
258
datasource=promDatasource,
259
259
legendFormat='{{instance}}' ,
260
260
),
@@ -329,11 +329,11 @@ local databaseWritesPanel = {
329
329
},
330
330
};
331
331
332
- local databaseReadsPanel = {
332
+ local databaseReadsPanel(cfg) = {
333
333
datasource: promDatasource,
334
334
targets: [
335
335
prometheus.target(
336
- 'rate(couchdb_database_reads_total{' + matcher + '}[$__rate_interval])' ,
336
+ 'rate(couchdb_database_reads_total{' + getMatcher(cfg) + '}[$__rate_interval])' ,
337
337
datasource=promDatasource,
338
338
legendFormat='{{instance}}' ,
339
339
),
@@ -408,11 +408,11 @@ local databaseReadsPanel = {
408
408
},
409
409
};
410
410
411
- local viewReadsPanel = {
411
+ local viewReadsPanel(cfg) = {
412
412
datasource: promDatasource,
413
413
targets: [
414
414
prometheus.target(
415
- 'rate(couchdb_httpd_view_reads_total{' + matcher + '}[$__rate_interval])' ,
415
+ 'rate(couchdb_httpd_view_reads_total{' + getMatcher(cfg) + '}[$__rate_interval])' ,
416
416
datasource=promDatasource,
417
417
legendFormat='{{instance}}' ,
418
418
),
@@ -487,11 +487,11 @@ local viewReadsPanel = {
487
487
},
488
488
};
489
489
490
- local viewTimeoutsPanel = {
490
+ local viewTimeoutsPanel(cfg) = {
491
491
datasource: promDatasource,
492
492
targets: [
493
493
prometheus.target(
494
- 'rate(couchdb_httpd_view_timeouts_total{' + matcher + '}[$__rate_interval])' ,
494
+ 'rate(couchdb_httpd_view_timeouts_total{' + getMatcher(cfg) + '}[$__rate_interval])' ,
495
495
datasource=promDatasource,
496
496
legendFormat='{{instance}}' ,
497
497
),
@@ -566,11 +566,11 @@ local viewTimeoutsPanel = {
566
566
},
567
567
};
568
568
569
- local temporaryViewReadsPanel = {
569
+ local temporaryViewReadsPanel(cfg) = {
570
570
datasource: promDatasource,
571
571
targets: [
572
572
prometheus.target(
573
- 'rate(couchdb_httpd_temporary_view_reads_total{' + matcher + '}[$__rate_interval])' ,
573
+ 'rate(couchdb_httpd_temporary_view_reads_total{' + getMatcher(cfg) + '}[$__rate_interval])' ,
574
574
datasource=promDatasource,
575
575
legendFormat='{{instance}}' ,
576
576
),
@@ -653,11 +653,11 @@ local requestsRow = {
653
653
collapsed: false ,
654
654
};
655
655
656
- local requestMethodsPanel = {
656
+ local requestMethodsPanel(cfg) = {
657
657
datasource: promDatasource,
658
658
targets: [
659
659
prometheus.target(
660
- 'rate(couchdb_httpd_request_methods{' + matcher + '}[$__rate_interval]) != 0' ,
660
+ 'rate(couchdb_httpd_request_methods{' + getMatcher(cfg) + '}[$__rate_interval]) != 0' ,
661
661
datasource=promDatasource,
662
662
legendFormat='{{instance}} - {{method}}' ,
663
663
),
@@ -732,26 +732,26 @@ local requestMethodsPanel = {
732
732
},
733
733
};
734
734
735
- local requestLatencyPanel = {
735
+ local requestLatencyPanel(cfg) = {
736
736
datasource: promDatasource,
737
737
targets: [
738
738
prometheus.target(
739
- 'couchdb_request_time_seconds{' + matcher + ', quantile="0.5"}' ,
739
+ 'couchdb_request_time_seconds{' + getMatcher(cfg) + ', quantile="0.5"}' ,
740
740
datasource=promDatasource,
741
741
legendFormat='{{instance}} - p50' ,
742
742
),
743
743
prometheus.target(
744
- 'couchdb_request_time_seconds{' + matcher + ', quantile="0.75"}' ,
744
+ 'couchdb_request_time_seconds{' + getMatcher(cfg) + ', quantile="0.75"}' ,
745
745
datasource=promDatasource,
746
746
legendFormat='{{instance}} - p75' ,
747
747
),
748
748
prometheus.target(
749
- 'couchdb_request_time_seconds{' + matcher + ', quantile="0.95"}' ,
749
+ 'couchdb_request_time_seconds{' + getMatcher(cfg) + ', quantile="0.95"}' ,
750
750
datasource=promDatasource,
751
751
legendFormat='{{instance}} - p95' ,
752
752
),
753
753
prometheus.target(
754
- 'couchdb_request_time_seconds{' + matcher + ', quantile="0.99"}' ,
754
+ 'couchdb_request_time_seconds{' + getMatcher(cfg) + ', quantile="0.99"}' ,
755
755
datasource=promDatasource,
756
756
legendFormat='{{instance}} - p99' ,
757
757
),
@@ -826,11 +826,11 @@ local requestLatencyPanel = {
826
826
},
827
827
};
828
828
829
- local bulkRequestsPanel = {
829
+ local bulkRequestsPanel(cfg) = {
830
830
datasource: promDatasource,
831
831
targets: [
832
832
prometheus.target(
833
- 'rate(couchdb_httpd_bulk_requests_total{' + matcher + '}[$__rate_interval])' ,
833
+ 'rate(couchdb_httpd_bulk_requests_total{' + getMatcher(cfg) + '}[$__rate_interval])' ,
834
834
datasource=promDatasource,
835
835
legendFormat='{{instance}}' ,
836
836
),
@@ -905,29 +905,29 @@ local bulkRequestsPanel = {
905
905
},
906
906
};
907
907
908
- local responseStatusOverviewPanel = {
908
+ local responseStatusOverviewPanel(cfg) = {
909
909
datasource: promDatasource,
910
910
targets: [
911
911
prometheus.target(
912
- 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + matcher + ', code=~"2.*"}[$__interval:])) != 0' ,
912
+ 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + getMatcher(cfg) + ', code=~"2.*"}[$__interval:])) != 0' ,
913
913
datasource=promDatasource,
914
914
legendFormat='{{instance}} - 2xx' ,
915
915
interval='1m' ,
916
916
),
917
917
prometheus.target(
918
- 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + matcher + ', code=~"3.*"}[$__interval:])) != 0' ,
918
+ 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + getMatcher(cfg) + ', code=~"3.*"}[$__interval:])) != 0' ,
919
919
datasource=promDatasource,
920
920
legendFormat='{{instance}} - 3xx' ,
921
921
interval='1m' ,
922
922
),
923
923
prometheus.target(
924
- 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + matcher + ', code=~"4.*"}[$__interval:])) != 0' ,
924
+ 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + getMatcher(cfg) + ', code=~"4.*"}[$__interval:])) != 0' ,
925
925
datasource=promDatasource,
926
926
legendFormat='{{instance}} - 4xx' ,
927
927
interval='1m' ,
928
928
),
929
929
prometheus.target(
930
- 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + matcher + ', code=~"5.*"}[$__interval:])) != 0' ,
930
+ 'sum by(instance, couchdb_cluster) (increase(couchdb_httpd_status_codes{' + getMatcher(cfg) + ', code=~"5.*"}[$__interval:])) != 0' ,
931
931
datasource=promDatasource,
932
932
legendFormat='{{instance}} - 5xx' ,
933
933
interval='1m' ,
@@ -973,11 +973,11 @@ local responseStatusOverviewPanel = {
973
973
},
974
974
};
975
975
976
- local goodResponseStatusesPanel = {
976
+ local goodResponseStatusesPanel(cfg) = {
977
977
datasource: promDatasource,
978
978
targets: [
979
979
prometheus.target(
980
- 'rate(couchdb_httpd_status_codes{' + matcher + ', code=~"[23].*"}[$__rate_interval]) != 0' ,
980
+ 'rate(couchdb_httpd_status_codes{' + getMatcher(cfg) + ', code=~"[23].*"}[$__rate_interval]) != 0' ,
981
981
datasource=promDatasource,
982
982
legendFormat='{{instance}} - {{code}}' ,
983
983
),
@@ -1052,11 +1052,11 @@ local goodResponseStatusesPanel = {
1052
1052
},
1053
1053
};
1054
1054
1055
- local errorResponseStatusesPanel = {
1055
+ local errorResponseStatusesPanel(cfg) = {
1056
1056
datasource: promDatasource,
1057
1057
targets: [
1058
1058
prometheus.target(
1059
- 'rate(couchdb_httpd_status_codes{' + matcher + ', code=~"[45].*"}[$__rate_interval]) != 0' ,
1059
+ 'rate(couchdb_httpd_status_codes{' + getMatcher(cfg) + ', code=~"[45].*"}[$__rate_interval]) != 0' ,
1060
1060
datasource=promDatasource,
1061
1061
legendFormat='{{instance}} - {{code}}' ,
1062
1062
),
@@ -1139,11 +1139,11 @@ local logsRow = {
1139
1139
collapsed: false ,
1140
1140
};
1141
1141
1142
- local logTypesPanel = {
1142
+ local logTypesPanel(cfg) = {
1143
1143
datasource: promDatasource,
1144
1144
targets: [
1145
1145
prometheus.target(
1146
- 'increase(couchdb_couch_log_requests_total{' + matcher + ', level=~"$log_level"}[$__interval:]) != 0' ,
1146
+ 'increase(couchdb_couch_log_requests_total{' + getMatcher(cfg) + ', level=~"$log_level"}[$__interval:]) != 0' ,
1147
1147
datasource=promDatasource,
1148
1148
legendFormat='{{instance}} - {{level}}' ,
1149
1149
interval='1m' ,
@@ -1219,13 +1219,13 @@ local logTypesPanel = {
1219
1219
},
1220
1220
};
1221
1221
1222
- local systemLogsPanel = {
1222
+ local systemLogsPanel(cfg) = {
1223
1223
datasource: lokiDatasource,
1224
1224
targets: [
1225
1225
{
1226
1226
datasource: lokiDatasource,
1227
1227
editorMode: 'code' ,
1228
- expr: '{' + matcher + ', filename="/var/log/couchdb/couchdb.log"} |~ "$log_level"' ,
1228
+ expr: '{' + getMatcher(cfg) + ', filename="/var/log/couchdb/couchdb.log"} |~ "$log_level"' ,
1229
1229
queryType: 'range' ,
1230
1230
refId: 'A' ,
1231
1231
},
@@ -1296,6 +1296,18 @@ local systemLogsPanel = {
1296
1296
allValues='' ,
1297
1297
sort=0
1298
1298
),
1299
+ template.new(
1300
+ 'cluster' ,
1301
+ promDatasource,
1302
+ 'label_values(couchdb_couch_replicator_cluster_is_stable{%(multiClusterSelector)s}, cluster)' % $._config,
1303
+ label='Cluster' ,
1304
+ refresh=1 ,
1305
+ includeAll=true ,
1306
+ multi=true ,
1307
+ allValues='' ,
1308
+ hide=if $._config.enableMultiCluster then '' else 'variable' % $._config,
1309
+ sort=0
1310
+ ),
1299
1311
template.new(
1300
1312
'couchdb_cluster' ,
1301
1313
promDatasource,
@@ -1335,26 +1347,26 @@ local systemLogsPanel = {
1335
1347
.addPanels(
1336
1348
std.flattenArrays ([
1337
1349
[
1338
- erlangMemoryUsagePanel { gridPos: { h: 6 , w: 8 , x: 0 , y: 0 } },
1339
- openOSFilesPanel { gridPos: { h: 6 , w: 8 , x: 8 , y: 0 } },
1340
- openDatabasesPanel { gridPos: { h: 6 , w: 8 , x: 16 , y: 0 } },
1341
- databaseWritesPanel { gridPos: { h: 6 , w: 12 , x: 0 , y: 6 } },
1342
- databaseReadsPanel { gridPos: { h: 6 , w: 12 , x: 12 , y: 6 } },
1343
- viewReadsPanel { gridPos: { h: 6 , w: 8 , x: 0 , y: 12 } },
1344
- viewTimeoutsPanel { gridPos: { h: 6 , w: 8 , x: 8 , y: 12 } },
1345
- temporaryViewReadsPanel { gridPos: { h: 6 , w: 8 , x: 16 , y: 12 } },
1350
+ erlangMemoryUsagePanel($._config) { gridPos: { h: 6 , w: 8 , x: 0 , y: 0 } },
1351
+ openOSFilesPanel($._config) { gridPos: { h: 6 , w: 8 , x: 8 , y: 0 } },
1352
+ openDatabasesPanel($._config) { gridPos: { h: 6 , w: 8 , x: 16 , y: 0 } },
1353
+ databaseWritesPanel($._config) { gridPos: { h: 6 , w: 12 , x: 0 , y: 6 } },
1354
+ databaseReadsPanel($._config) { gridPos: { h: 6 , w: 12 , x: 12 , y: 6 } },
1355
+ viewReadsPanel($._config) { gridPos: { h: 6 , w: 8 , x: 0 , y: 12 } },
1356
+ viewTimeoutsPanel($._config) { gridPos: { h: 6 , w: 8 , x: 8 , y: 12 } },
1357
+ temporaryViewReadsPanel($._config) { gridPos: { h: 6 , w: 8 , x: 16 , y: 12 } },
1346
1358
requestsRow { gridPos: { h: 1 , w: 24 , x: 0 , y: 18 } },
1347
- bulkRequestsPanel { gridPos: { h: 6 , w: 12 , x: 0 , y: 19 } },
1348
- requestLatencyPanel { gridPos: { h: 6 , w: 12 , x: 12 , y: 19 } },
1349
- requestMethodsPanel { gridPos: { h: 6 , w: 12 , x: 0 , y: 25 } },
1350
- responseStatusOverviewPanel { gridPos: { h: 6 , w: 12 , x: 12 , y: 25 } },
1351
- goodResponseStatusesPanel { gridPos: { h: 6 , w: 12 , x: 0 , y: 31 } },
1352
- errorResponseStatusesPanel { gridPos: { h: 6 , w: 12 , x: 12 , y: 31 } },
1359
+ bulkRequestsPanel($._config) { gridPos: { h: 6 , w: 12 , x: 0 , y: 19 } },
1360
+ requestLatencyPanel($._config) { gridPos: { h: 6 , w: 12 , x: 12 , y: 19 } },
1361
+ requestMethodsPanel($._config) { gridPos: { h: 6 , w: 12 , x: 0 , y: 25 } },
1362
+ responseStatusOverviewPanel($._config) { gridPos: { h: 6 , w: 12 , x: 12 , y: 25 } },
1363
+ goodResponseStatusesPanel($._config) { gridPos: { h: 6 , w: 12 , x: 0 , y: 31 } },
1364
+ errorResponseStatusesPanel($._config) { gridPos: { h: 6 , w: 12 , x: 12 , y: 31 } },
1353
1365
logsRow { gridPos: { h: 1 , w: 24 , x: 0 , y: 37 } },
1354
- logTypesPanel { gridPos: { h: 6 , w: 24 , x: 0 , y: 38 } },
1366
+ logTypesPanel($._config) { gridPos: { h: 6 , w: 24 , x: 0 , y: 38 } },
1355
1367
],
1356
1368
if $._config.enableLokiLogs then [
1357
- systemLogsPanel { gridPos: { h: 6 , w: 24 , x: 0 , y: 44 } },
1369
+ systemLogsPanel($._config) { gridPos: { h: 6 , w: 24 , x: 0 , y: 44 } },
1358
1370
] else [],
1359
1371
[
1360
1372
],
0 commit comments