Skip to content

Commit

Permalink
alertmanagerconfig/opsgenie: allow specify updateAlert
Browse files Browse the repository at this point in the history
AlertManager Opsgenie receiver supports update_alert option, which is by
default turned off. Allow controlling the settings via
AlertmanagerConfig.

See prometheus/alertmanager#2519
  • Loading branch information
mahumpula committed Dec 25, 2021
1 parent 2421947 commit 67c94f2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,7 @@ OpsGenieConfig configures notifications via OpsGenie. See https://prometheus.io/
| details | A set of arbitrary key/value pairs that provide further detail about the incident. | [][KeyValue](#keyvalue) | false |
| responders | List of responders responsible for notifications. | [][OpsGenieConfigResponder](#opsgenieconfigresponder) | false |
| httpConfig | HTTP client configuration. | *[HTTPConfig](#httpconfig) | false |
| updateAlerts | Update alert descritpion on change. | bool | false |

[Back to TOC](#table-of-contents)

Expand Down
3 changes: 3 additions & 0 deletions bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,9 @@ spec:
description: Comma separated list of tags attached to
the notifications.
type: string
updateAlerts:
description: Update alert descritpion on change.
type: boolean
type: object
type: array
pagerdutyConfigs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,9 @@ spec:
description: Comma separated list of tags attached to
the notifications.
type: string
updateAlerts:
description: Update alert descritpion on change.
type: boolean
type: object
type: array
pagerdutyConfigs:
Expand Down
4 changes: 4 additions & 0 deletions jsonnet/prometheus-operator/alertmanagerconfigs-crd.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@
"tags": {
"description": "Comma separated list of tags attached to the notifications.",
"type": "string"
},
"updateAlerts": {
"description": "Update alert descritpion on change.",
"type": "boolean"
}
},
"type": "object"
Expand Down
Binary file added pkg/alertmanager/.types.go.swp
Binary file not shown.
1 change: 1 addition & 0 deletions pkg/alertmanager/amcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ func (cg *configGenerator) convertOpsgenieConfig(ctx context.Context, in monitor
Tags: in.Tags,
Note: in.Note,
Priority: in.Priority,
UpdateAlerts: in.UpdateAlerts,
}

if in.APIKey != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/alertmanager/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ type opsgenieConfig struct {
Tags string `yaml:"tags,omitempty" json:"tags,omitempty"`
Note string `yaml:"note,omitempty" json:"note,omitempty"`
Priority string `yaml:"priority,omitempty" json:"priority,omitempty"`
UpdateAlerts bool `yaml:"update_alerts,omitempty" json:"update_alerts,omitempty"`
}

type weChatConfig struct {
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ type OpsGenieConfig struct {
// HTTP client configuration.
// +optional
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"`
// Update alert descritpion on change.
// +optional
UpdateAlerts bool `json:"updateAlerts,omitempty"`
}

// Validate ensures OpsGenieConfig is valid
Expand Down

0 comments on commit 67c94f2

Please sign in to comment.