Skip to content
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

602 fix dashboard and silence urls #603

Merged
merged 6 commits into from
Aug 14, 2023
Merged
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
2 changes: 1 addition & 1 deletion monitoring-as-code/run-mixin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mkdir "$PWD"/_input
cp "$input_path"/"$mixin"-mixin.jsonnet "$PWD"/_input/mixin.jsonnet

# Errors if account is not np, pr or localhost
(echo "$account" | grep -v -Eq "^(np|pr|localhost)$") &&
(echo "$account" | grep -v -Eq "^(np|pr|localhost|green)$") &&
echo "Invalid account type" >&2 &&
exit 1

Expand Down
13 changes: 11 additions & 2 deletions monitoring-as-code/src/alerts/burn-rate-alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ local createBurnRateAlerts(config, sliSpec, sliKey, journeyKey) =
local alertName = std.join('_', [std.strReplace(macConfig.macDashboardPrefix.uid, '-', '_'), config.product, journeyKey, sliKey, sliSpec.sliType, 'ErrorBudgetBurn']),
local severity = getSeverity(errorBudgetBurnWindow, config, sliSpec),
local alertTitle = createAlertTitle(errorBudgetBurnWindow, config, sliSpec, sliKey, journeyKey),
local grafSilencePath = 'alerting/silence/new?alertmanager=alertmanager&matcher=alertname=%(alertName)s' % {
alertName: alertName,
},
local amSilencePath = '#/silences/new?filter={alertname%%3D%%22%(alertName)s%%22, journey%%3D%%22%(journey)s%%22, service%%3D%%22%(service)s%%22}' % {
alertName: alertName,
journey: journeyKey,
service: config.product,
},

local alertPayloadConfig = getAlertPayloadConfig(alertName, severity, alertTitle, errorBudgetBurnWindow, config, sliSpec, sliKey, journeyKey),
local alertPayload = createAlertPayload(alertPayloadConfig),
Expand Down Expand Up @@ -137,8 +145,9 @@ local createBurnRateAlerts(config, sliSpec, sliKey, journeyKey) =
journeyUid: std.join('-', [macConfig.macDashboardPrefix.uid, config.product, journeyKey]),
environment: if std.objectHas(config, 'generic') && config.generic then '' else '?var-environment=%s' % config.environment,
},
silenceurl: '%(alertmanagerUrl)s/#/silences/new?filter={alertname%%3D%%22%(alertName)s%%22, journey%%3D%%22%(journey)s%%22, service%%3D%%22%(service)s%%22}' % {
alertmanagerUrl: config.alertmanagerUrl,
silenceurl: '%(silenceUrl)s/%(silencePath)s' % {
silenceUrl: config.silenceUrl,
silencePath: if std.objectHas(config, 'alertmanagerUrl') then amSilencePath else grafSilencePath,
alertName: alertName,
journey: journeyKey,
service: config.product,
Expand Down
3 changes: 2 additions & 1 deletion monitoring-as-code/src/mixin-builder.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ local updateConfig(passedConfig) =
account: account,
macVersion: macVersion,
grafanaUrl: getUrl('grafana', passedConfig.grafanaUrl, account),
alertmanagerUrl: getUrl('alertmanager', passedConfig.alertmanagerUrl, account),
// looking to amend
silenceUrl: if std.objectHas(passedConfig, 'alertmanagerUrl') then getUrl('alertmanager', passedConfig.alertmanagerUrl, account) else getUrl('grafana', passedConfig.grafanaUrl, account),
templates: dashboardFunctions.createServiceTemplates(passedConfig),
};

Expand Down
Loading