Skip to content

Commit 7e1d8bf

Browse files
authored
OracleDB k8s plugin support (#1187)
* updated logs expression to include more directories * wip oracledb mixin updates * replaced static matcher with getMatcher and updated panels to take in matcher argument * updated panels in addPanels to use getMatcher * fixed typo * added instance selector back to tablespace query
1 parent 090cb6b commit 7e1d8bf

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

oracledb-mixin/config.libsonnet

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
_config+:: {
3+
enableMultiCluster: false,
4+
oracledbSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"',
35
dashboardTags: ['oracledb-mixin'],
46
dashboardPeriod: 'now-1h',
57
dashboardTimezone: 'default',

oracledb-mixin/dashboards/overview.libsonnet

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local dashboardUid = 'oracledb-overview';
55

66
local prometheus = grafana.prometheus;
77
local promDatasourceName = 'prometheus_datasource';
8-
local matcher = 'job=~"$job", instance=~"$instance"';
8+
local getMatcher(cfg) = '%(oracledbSelector)s, instance=~"$instance"' % cfg;
99

1010
local promDatasource = {
1111
uid: '${%s}' % promDatasourceName,
@@ -15,7 +15,7 @@ local lokiDatasource = {
1515
uid: '$loki_datasource',
1616
};
1717

18-
local databaseStatusPanel = {
18+
local databaseStatusPanel(matcher) = {
1919
description: 'Database status either Up or Down. Colored to be green when Up or red when Down',
2020
fieldConfig: {
2121
defaults: {
@@ -81,7 +81,7 @@ local databaseStatusPanel = {
8181
type: 'stat',
8282
};
8383

84-
local sessionsPanel = {
84+
local sessionsPanel(matcher) = {
8585
datasource: promDatasource,
8686
description: 'Number of sessions and the limit overtime.',
8787
fieldConfig: {
@@ -171,7 +171,7 @@ local sessionsPanel = {
171171
type: 'timeseries',
172172
};
173173

174-
local processPanel = {
174+
local processPanel(matcher) = {
175175
datasource: promDatasource,
176176
description: 'Number of processes and the limit overtime.',
177177
fieldConfig: {
@@ -261,7 +261,7 @@ local processPanel = {
261261
type: 'timeseries',
262262
};
263263

264-
local alertLogPanel = {
264+
local alertLogPanel(matcher) = {
265265
datasource: lokiDatasource,
266266
description: 'Recent logs from alert log file',
267267
options: {
@@ -279,7 +279,7 @@ local alertLogPanel = {
279279
{
280280
datasource: lokiDatasource,
281281
editorMode: 'builder',
282-
expr: '{filename=~"/u01/base/diag/rdbms/.*/.*/trace/alert_.*log",' + matcher + '}',
282+
expr: '{filename=~"/.*/.*/diag/rdbms/.*/.*/trace/alert_.*log",' + matcher + '}',
283283
queryType: 'range',
284284
refId: 'A',
285285
},
@@ -294,7 +294,7 @@ local waitTimerow = {
294294
type: 'row',
295295
};
296296

297-
local applicationWaitTimePanel = {
297+
local applicationWaitTimePanel(matcher) = {
298298
datasource: promDatasource,
299299
description: 'Application wait time, in seconds, waiting for wait events.',
300300
fieldConfig: {
@@ -375,7 +375,7 @@ local applicationWaitTimePanel = {
375375
type: 'timeseries',
376376
};
377377

378-
local commitTimePanel = {
378+
local commitTimePanel(matcher) = {
379379
datasource: promDatasource,
380380
description: 'Commit wait time, in seconds, waiting for wait events.',
381381
fieldConfig: {
@@ -456,7 +456,7 @@ local commitTimePanel = {
456456
type: 'timeseries',
457457
};
458458

459-
local concurrencyWaitTime = {
459+
local concurrencyWaitTime(matcher) = {
460460
datasource: promDatasource,
461461
description: 'Concurrency wait time, in seconds, waiting for wait events.',
462462
fieldConfig: {
@@ -537,7 +537,7 @@ local concurrencyWaitTime = {
537537
type: 'timeseries',
538538
};
539539

540-
local configurationWaitTime = {
540+
local configurationWaitTime(matcher) = {
541541
datasource: promDatasource,
542542
description: 'Configuration wait time, in seconds waiting for wait events.',
543543
fieldConfig: {
@@ -618,7 +618,7 @@ local configurationWaitTime = {
618618
type: 'timeseries',
619619
};
620620

621-
local networkWaitTime = {
621+
local networkWaitTime(matcher) = {
622622
datasource: promDatasource,
623623
description: 'Network wait time, in seconds, waiting for wait events.',
624624
fieldConfig: {
@@ -699,7 +699,7 @@ local networkWaitTime = {
699699
type: 'timeseries',
700700
};
701701

702-
local schedulerWaitTime = {
702+
local schedulerWaitTime(matcher) = {
703703
datasource: promDatasource,
704704
description: 'Scheduler wait time, in seconds, waiting for wait events.',
705705
fieldConfig: {
@@ -780,7 +780,7 @@ local schedulerWaitTime = {
780780
type: 'timeseries',
781781
};
782782

783-
local systemIOWaitTime = {
783+
local systemIOWaitTime(matcher) = {
784784
datasource: promDatasource,
785785
description: 'System I/O wait time, in seconds, waiting for wait events.',
786786
fieldConfig: {
@@ -861,7 +861,7 @@ local systemIOWaitTime = {
861861
type: 'timeseries',
862862
};
863863

864-
local userIOWaitTime = {
864+
local userIOWaitTime(matcher) = {
865865
datasource: promDatasource,
866866
description: 'User I/O wait time, in seconds, waiting for wait events.',
867867
fieldConfig: {
@@ -948,7 +948,7 @@ local tablespaceRow = {
948948
type: 'row',
949949
};
950950

951-
local tablespaceSizePanel = {
951+
local tablespaceSizePanel(matcher) = {
952952
datasource: promDatasource,
953953
description: 'Shows the size overtime for the tablespace.',
954954
fieldConfig: {
@@ -1113,7 +1113,7 @@ local tablespaceSizePanel = {
11131113
template.new(
11141114
'tablespace',
11151115
promDatasource,
1116-
query='label_values(oracledb_tablespace_bytes{' + matcher + '}, tablespace)',
1116+
query='label_values(oracledb_tablespace_bytes{%(oracledbSelector)s, instance=~"$instance"}, tablespace)' % $._config,
11171117
label='Tablespace',
11181118
refresh='time',
11191119
includeAll=true,
@@ -1128,33 +1128,33 @@ local tablespaceSizePanel = {
11281128
.addPanels(
11291129
std.flattenArrays([
11301130
[
1131-
databaseStatusPanel { gridPos: { h: 6, w: 4, x: 0, y: 0 } },
1132-
sessionsPanel { gridPos: { h: 6, w: 10, x: 4, y: 0 } },
1133-
processPanel { gridPos: { h: 6, w: 10, x: 14, y: 0 } },
1131+
databaseStatusPanel(getMatcher($._config)) { gridPos: { h: 6, w: 4, x: 0, y: 0 } },
1132+
sessionsPanel(getMatcher($._config)) { gridPos: { h: 6, w: 10, x: 4, y: 0 } },
1133+
processPanel(getMatcher($._config)) { gridPos: { h: 6, w: 10, x: 14, y: 0 } },
11341134
],
11351135
if $._config.enableLokiLogs then [
1136-
alertLogPanel { gridPos: { h: 7, w: 24, x: 0, y: 6 } },
1136+
alertLogPanel(getMatcher($._config)) { gridPos: { h: 7, w: 24, x: 0, y: 6 } },
11371137
] else [],
11381138
[
11391139
waitTimerow { gridPos: { h: 1, w: 24, x: 0, y: 13 } },
11401140
],
11411141
[
1142-
applicationWaitTimePanel { gridPos: { h: 6, w: 6, x: 0, y: 14 } },
1143-
commitTimePanel { gridPos: { h: 6, w: 6, x: 6, y: 14 } },
1144-
concurrencyWaitTime { gridPos: { h: 6, w: 6, x: 12, y: 14 } },
1145-
configurationWaitTime { gridPos: { h: 6, w: 6, x: 18, y: 14 } },
1142+
applicationWaitTimePanel(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 0, y: 14 } },
1143+
commitTimePanel(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 6, y: 14 } },
1144+
concurrencyWaitTime(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 12, y: 14 } },
1145+
configurationWaitTime(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 18, y: 14 } },
11461146
],
11471147
[
1148-
networkWaitTime { gridPos: { h: 6, w: 6, x: 0, y: 20 } },
1149-
schedulerWaitTime { gridPos: { h: 6, w: 6, x: 6, y: 20 } },
1150-
systemIOWaitTime { gridPos: { h: 6, w: 6, x: 12, y: 20 } },
1151-
userIOWaitTime { gridPos: { h: 6, w: 6, x: 18, y: 20 } },
1148+
networkWaitTime(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 0, y: 20 } },
1149+
schedulerWaitTime(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 6, y: 20 } },
1150+
systemIOWaitTime(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 12, y: 20 } },
1151+
userIOWaitTime(getMatcher($._config)) { gridPos: { h: 6, w: 6, x: 18, y: 20 } },
11521152
],
11531153
[
11541154
tablespaceRow { gridPos: { h: 1, w: 24, x: 0, y: 26 } },
11551155
],
11561156
[
1157-
tablespaceSizePanel { gridPos: { h: 6, w: 24, x: 0, y: 27 } },
1157+
tablespaceSizePanel(getMatcher($._config)) { gridPos: { h: 6, w: 24, x: 0, y: 27 } },
11581158
],
11591159
])
11601160
),

0 commit comments

Comments
 (0)