diff --git a/mixin-utils/utils.libsonnet b/mixin-utils/utils.libsonnet index c0692526c..5b4f2c3c0 100644 --- a/mixin-utils/utils.libsonnet +++ b/mixin-utils/utils.libsonnet @@ -117,12 +117,13 @@ local g = import 'grafana-builder/grafana.libsonnet'; // withRunbookURL - Add/Override the runbook_url annotations for all alerts inside a list of rule groups. // - url_format: an URL format for the runbook, the alert name will be substituted in the URL. // - groups: the list of rule groups containing alerts. - withRunbookURL(url_format, groups):: + // - annotation_key: the key to use for the annotation whose value will be the formatted runbook URL. + withRunbookURL(url_format, groups, annotation_key='runbook_url'):: local update_rule(rule) = if std.objectHas(rule, 'alert') then rule { annotations+: { - runbook_url: url_format % rule.alert, + [annotation_key]: url_format % rule.alert, }, } else rule;