Skip to content

chore: Update OracleDB Mixin to use modern libraries & cleanup #1470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions oracledb-mixin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ OracleDB mixin is a set of configurable alerts and dashboards that use the third
| OracledbReachingSessionLimit | number of processess being utilized exceeded a theshold. | 85% |
| OracledbReachingProcessLimit | The number of processess being utilized exceeded the threshold. | 85% |
| OracledbTablespaceReachingCapacity | A Tablespace is exceeded its threshold of its maximum allotted space. | 85% |
| OracledbFileDescriptorLimit | File descriptors usage is reaching its threshold. | 85% |

Default thresholds can be configured in `config.libsonnet`.

```js
{
_config+:: {
alertsFileDescriptorThreshold: '85', // %
alertsProcessThreshold: '85', // %
alertsSessionThreshold: '85', // %
alertsProcessThreshold: '85', // %
alertsTablespaceThreshold: '85', // %
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
prometheusAlerts+:: {
new(this): {
groups+: [
{
name: 'OracleDBAlerts',
Expand All @@ -8,49 +8,49 @@
alert: 'OracledbReachingSessionLimit',
expr: |||
oracledb_resource_current_utilization{resource_name="sessions"} / oracledb_resource_limit_value{resource_name="sessions"} * 100 > %(alertsSessionThreshold)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'The number of sessions being utilized exceeded %(alertsSessionThreshold)s%%.' % $._config,
summary: 'The number of sessions being utilized exceeded %(alertsSessionThreshold)s%%.' % this.config,
description:
('{{ printf "%%.2f" $value }}%% of sessions are being utilized which is above the ' +
'threshold %(alertsSessionThreshold)s%%. This could mean that {{$labels.instance}} is being overutilized.') % $._config,
'threshold %(alertsSessionThreshold)s%%. This could mean that {{$labels.instance}} is being overutilized.') % this.config,
},
},
{
alert: 'OracledbReachingProcessLimit',
expr: |||
oracledb_resource_current_utilization{resource_name="processes"} / oracledb_resource_limit_value{resource_name="processes"} * 100 > %(alertsProcessThreshold)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'The number of processess being utilized exceeded the threshold of %(alertsProcessThreshold)s%%.' % $._config,
summary: 'The number of processess being utilized exceeded the threshold of %(alertsProcessThreshold)s%%.' % this.config,
description:
('{{ printf "%%.2f" $value }} of processes are being utilized which is above the' +
'threshold %(alertsProcessThreshold)s%%. This could potentially mean that ' +
'{{$labels.instance}} runs out of processes it can spin up.') % $._config,
'{{$labels.instance}} runs out of processes it can spin up.') % this.config,
},
},
{
alert: 'OracledbTablespaceReachingCapacity',
expr: |||
oracledb_tablespace_bytes / oracledb_tablespace_max_bytes * 100 > %(alertsTablespaceThreshold)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'A tablespace is exceeding more than %(alertsTablespaceThreshold)s%% of its maximum allotted space.' % $._config,
summary: 'A tablespace is exceeding more than %(alertsTablespaceThreshold)s%% of its maximum allotted space.' % this.config,
description:
('{{ printf "%%.2f" $value }}%% of bytes are being utilized by the tablespace {{$labels.tablespace}} on the instance {{$labels.instance}}, ' +
'which is above the threshold %(alertsTablespaceThreshold)s%%.') % $._config,
'which is above the threshold %(alertsTablespaceThreshold)s%%.') % this.config,
},
},
],
Expand Down
44 changes: 31 additions & 13 deletions oracledb-mixin/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
{
_config+:: {
enableMultiCluster: false,
oracledbSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"',
dashboardTags: ['oracledb-mixin'],
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',
local this = self,
filteringSelector: 'job=~"integrations/oracledb"',
enableMultiCluster: false,
groupLabels: if self.enableMultiCluster then ['cluster', 'job'] else ['job'],
instanceLabels: ['instance'],
tablespaceLabels: ['tablespace'],
uid: 'oracledb',

alertsFileDescriptorThreshold: '85', // %
alertsProcessThreshold: '85', // %
alertsSessionThreshold: '85', // %
alertsTablespaceThreshold: '85', // %
dashboardNamePrefix: 'Oracle Database',
dashboardTags: ['oracledb-mixin'],
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',

// enable Loki logs
enableLokiLogs: true,
// Data source configuration
metricsSource: 'prometheus',
enableLokiLogs: true,
logLabels: this.groupLabels + this.instanceLabels,
extraLogLabels: [],
logsVolumeGroupBy: 'level',
showLogsVolume: true,

// Alerting thresholds
alertsFileDescriptorThreshold: 85, // %
alertsProcessThreshold: 85, // %
alertsSessionThreshold: 85, // %
alertsTablespaceThreshold: 85, // %

// Signals configuration
signals+: {
sessions: (import './signals/sessions.libsonnet')(this),
waittimes: (import './signals/waittimes.libsonnet')(this),
tablespace: (import './signals/tablespace.libsonnet')(this),
},
}
88 changes: 88 additions & 0 deletions oracledb-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
local g = import './g.libsonnet';
local logslib = import 'logs-lib/logs/main.libsonnet';

{
local root = self,

applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period):
g.dashboard.withTags(tags)
+ g.dashboard.withUid(uid)
+ g.dashboard.withLinks(std.objectValues(links))
+ g.dashboard.withTimezone(timezone)
+ g.dashboard.withRefresh(refresh)
+ g.dashboard.time.withFrom(period)
+ g.dashboard.withVariables(vars)
+ g.dashboard.withAnnotations(std.objectValues(annotations)),


new(this)::
local prefix = this.config.dashboardNamePrefix;
local links = this.grafana.links;
local tags = this.config.dashboardTags;
local uid = g.util.string.slugify(this.config.uid);
local vars = this.grafana.variables;
local annotations = this.grafana.annotations;
local refresh = this.config.dashboardRefresh;
local period = this.config.dashboardPeriod;
local timezone = this.config.dashboardTimezone;

{
'oracledb-overview.json':
g.dashboard.new(prefix + ' overview')
+ g.dashboard.withPanels(
g.util.panel.resolveCollapsedFlagOnRows(
g.util.grid.wrapPanels(
[
this.grafana.rows.overview + g.panel.row.withCollapsed(false),
this.grafana.rows.waittimes + g.panel.row.withCollapsed(false),
this.grafana.rows.tablespace + g.panel.row.withCollapsed(false),
],
),
)
)
+ root.applyCommon(
vars.multiInstance,
uid + '_oracledb_overview',
tags,
links { oracledbOverview+:: {} },
annotations,
timezone,
refresh,
period
),
}
+

if this.config.enableLokiLogs then {
'logs.json':
logslib.new(
prefix + ' logs',
datasourceName=this.grafana.variables.datasources.loki.name,
datasourceRegex=this.grafana.variables.datasources.loki.regex,
filterSelector=this.config.filteringSelector,
labels=this.config.groupLabels + this.config.extraLogLabels,
formatParser=null,
showLogsVolume=this.config.showLogsVolume,
)
{
dashboards+:
{
logs+:
root.applyCommon(super.logs.templating.list, uid=uid + '-logs', tags=tags, links=links { logs+:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period),
},
panels+:
{
logs+:
g.panel.logs.options.withEnableLogDetails(true)
+ g.panel.logs.options.withShowTime(false)
+ g.panel.logs.options.withWrapLogMessage(false),
},
variables+: {
toArray+: [
this.grafana.variables.datasources.prometheus { hide: 2 },
],
},
}.dashboards.logs,
}
else {},
}
1 change: 0 additions & 1 deletion oracledb-mixin/dashboards/dashboards.libsonnet

This file was deleted.

Loading
Loading