Skip to content

MSSQL Modernization #1450

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 4 commits 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
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
prometheusAlerts+:: {
groups+: [
new(this): {
groups: [
{
name: 'MSSQLAlerts',
rules: [
{
alert: 'MSSQLHighNumberOfDeadlocks',
expr: |||
increase(mssql_deadlocks_total{}[5m]) > %(alertsWarningDeadlocks5m)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'There are deadlocks ocurring in the database.',
summary: 'There are deadlocks occurring in the database.',
description:
('{{ printf "%%.2f" $value }} deadlocks have occurred over the last 5 minutes on {{$labels.instance}}, ' +
'which is above threshold of %(alertsWarningDeadlocks5m)s deadlocks.') % $._config,
'which is above threshold of %(alertsWarningDeadlocks5m)s deadlocks.') % this.config,
},
},
{
alert: 'MSSQLModerateReadStallTime',
expr: |||
1000 * increase(mssql_io_stall_seconds_total{operation="read"}[5m]) > %(alertsWarningModerateReadStallTimeMS)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'warning',
Expand All @@ -33,14 +33,14 @@
summary: 'There is a moderate amount of IO stall for database reads.',
description:
('{{ printf "%%.2f" $value }}ms of IO read stall has occurred on {{$labels.instance}}, ' +
'which is above threshold of %(alertsWarningModerateReadStallTimeMS)sms.') % $._config,
'which is above threshold of %(alertsWarningModerateReadStallTimeMS)sms.') % this.config,
},
},
{
alert: 'MSSQLHighReadStallTime',
expr: |||
1000 * increase(mssql_io_stall_seconds_total{operation="read"}[5m]) > %(alertsCriticalHighReadStallTimeMS)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
Expand All @@ -49,14 +49,14 @@
summary: 'There is a high amount of IO stall for database reads.',
description:
('{{ printf "%%.2f" $value }}ms of IO read stall has occurred on {{$labels.instance}}, ' +
'which is above threshold of %(alertsCriticalHighReadStallTimeMS)sms.') % $._config,
'which is above threshold of %(alertsCriticalHighReadStallTimeMS)sms.') % this.config,
},
},
{
alert: 'MSSQLModerateWriteStallTime',
expr: |||
1000 * increase(mssql_io_stall_seconds_total{operation="write"}[5m]) > %(alertsWarningModerateWriteStallTimeMS)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'warning',
Expand All @@ -65,14 +65,14 @@
summary: 'There is a moderate amount of IO stall for database writes.',
description:
('{{ printf "%%.2f" $value }}ms of IO write stall has occurred on {{$labels.instance}}, ' +
'which is above threshold of %(alertsWarningModerateWriteStallTimeMS)sms.') % $._config,
'which is above threshold of %(alertsWarningModerateWriteStallTimeMS)sms.') % this.config,
},
},
{
alert: 'MSSQLHighWriteStallTime',
expr: |||
1000 * increase(mssql_io_stall_seconds_total{operation="write"}[5m]) > %(alertsCriticalHighWriteStallTimeMS)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
Expand All @@ -81,7 +81,7 @@
summary: 'There is a high amount of IO stall for database writes.',
description:
('{{ printf "%%.2f" $value }}ms of IO write stall has occurred on {{$labels.instance}}, ' +
'which is above threshold of %(alertsCriticalHighWriteStallTimeMS)sms.') % $._config,
'which is above threshold of %(alertsCriticalHighWriteStallTimeMS)sms.') % this.config,
},
},
],
Expand Down
42 changes: 25 additions & 17 deletions mssql-mixin/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
{
_config+:: {
enableMultiCluster: false,
multiclusterSelector: 'job=~"$job"',
mssqlSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"',
dashboardTags: ['mssql-mixin'],
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',
enableMultiCluster: false,
filteringSelector: 'job=~"integrations/mssql"',
groupLabels: if self.enableMultiCluster then ['job', 'cluster'] else ['job'],
instanceLabels: ['instance'],
dashboardTags: ['mssql-mixin'],
legendLabels: ['instance'],
uid: 'mssql',
dashboardNamePrefix: 'MSSQL',

// alert thresholds
alertsWarningDeadlocks5m: 10,
alertsWarningModerateReadStallTimeMS: 200,
alertsCriticalHighReadStallTimeMS: 400,
alertsWarningModerateWriteStallTimeMS: 200,
alertsCriticalHighWriteStallTimeMS: 400,
// additional params
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',

// enable Loki logs
enableLokiLogs: true,
},
// logs lib related
enableLokiLogs: true,
logLabels: if self.enableMultiCluster then ['job', 'instance', 'cluster', 'level'] else ['job', 'instance', 'level'],
extraLogLabels: [], // Required by logs-lib
logsVolumeGroupBy: 'level',
showLogsVolume: true,

// alert thresholds
alertsWarningDeadlocks5m: 10,
alertsWarningModerateReadStallTimeMS: 200,
alertsCriticalHighReadStallTimeMS: 400,
alertsWarningModerateWriteStallTimeMS: 200,
alertsCriticalHighWriteStallTimeMS: 400,
}
115 changes: 115 additions & 0 deletions mssql-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
local g = import './g.libsonnet';
local logslib = import 'logs-lib/logs/main.libsonnet';
{
local root = self,
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;
local panels = this.grafana.panels;

{
mssql_overview:
g.dashboard.new(prefix + ' overview')
+ g.dashboard.withPanels(
g.util.panel.resolveCollapsedFlagOnRows(
g.util.grid.wrapPanels(
[
panels.connectionsPanel { gridPos+: { w: 12 } },
panels.batchRequestsPanel { gridPos+: { w: 12 } },
panels.severeErrorsPanel { gridPos+: { w: 12 } },
panels.deadlocksPanel { gridPos+: { w: 12 } },
panels.osMemoryUsagePanel { gridPos+: { w: 24 } },
panels.memoryManagerPanel { gridPos+: { w: 16 } },
panels.committedMemoryUtilizationPanel { gridPos+: { w: 8 } },
] +
[this.grafana.rows.database + g.panel.row.withCollapsed(false)],
),
)
)
+ root.applyCommon(
vars.singleInstance,
uid + '_mssql_overview',
tags,
links { mssqlOverview+:: {} },
annotations,
timezone,
refresh,
period
),

mssql_pages:
g.dashboard.new(prefix + ' pages')
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
[
panels.pageFileMemoryPanel { gridPos+: { w: 12 } },
panels.bufferCacheHitPercentagePanel { gridPos+: { w: 12 } },
panels.pageCheckpointsPanel { gridPos+: { w: 12 } },
panels.pageFaultsPanel { gridPos+: { w: 12 } },
]
)
)
+ root.applyCommon(
vars.singleInstance,
uid + '_mssql_pages',
tags,
links { mssqlPages+:: {} },
annotations,
timezone,
refresh,
period
),

}
+
if this.config.enableLokiLogs then
{
logs:
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 {},

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)),
}
2 changes: 0 additions & 2 deletions mssql-mixin/dashboards/dashboards.libsonnet

This file was deleted.

Loading
Loading