config/notifiers: PagerDuty details override defaults#2495
config/notifiers: PagerDuty details override defaults#2495BenoitKnecht wants to merge 1 commit intoprometheus:mainfrom
Conversation
|
While I think this corresponds to the documented behavior, I recognize that it would break configuration that relied on the previous implementation. If you prefer, I can propose a patch that keeps the old behavior but removes the |
According to the Alertmanager documentation, the `details` option of
`pagerduty_config` defaults to
```
[ details: { <string>: <tmpl_string>, ... } | default = {
firing: '{{ template "pagerduty.default.instances" .Alerts.Firing }}'
resolved: '{{ template "pagerduty.default.instances" .Alerts.Resolved }}'
num_firing: '{{ .Alerts.Firing | len }}'
num_resolved: '{{ .Alerts.Resolved | len }}'
} ]
```
Which suggests that if `details` is provided in the configuration, the entire
option is overridden.
But instead, the individual keys of `details` are being set to the values above
if the corresponding key isn't present in the configuration. This means it's
impossible to remove those keys entirely; setting them to an empty string would
still have them displayed in PagerDuty.
This commit implements the documented behavior, i.e. it sets
`PagerDutyConfig.Details` to `DefaultPagerdutyDetails` only if the former is
`nil`.
Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
22ed3be to
2661162
Compare
Seems like, from the backwards compatibility point of view, this is the way to go. And even though having an empty string hold a special significance is not super clean, this would not go against any other types of default values in prometheus/alertmanager. |
Reformatted pagerduty notification to use default details labels. There is an issue being tracked on alertmanager - prometheus/alertmanager#2495, which we'll need in order to clean this up a bit more, but for now we will just reuse the existing default labels for pagerduty details.
|
Just ran into the same unexpected behavior. Is there a reason why this wasn't reviewed? |
|
@levshvarts @BenoitKnecht Any chance we can get some eyes on this? Running into this myself and I was able to blank them out in my template however pagerduty stops ordering these fields after exceeding 32 fields total, including blank fields. |
|
I believe this is not required anymore after #3944 |
Was just hitting this problem on latest this week. Will reopen another issue. |
According to the Alertmanager documentation, the
detailsoption ofpagerduty_configdefaults toWhich suggests that if
detailsis provided in the configuration, the entireoption is overridden.
But instead, the individual keys of
detailsare being set to the values aboveif the corresponding key isn't present in the configuration. This means it's
impossible to remove those keys entirely; setting them to an empty string would
still have them displayed in PagerDuty.
This commit implements the documented behavior, i.e. it sets
PagerDutyConfig.DetailstoDefaultPagerdutyDetailsonly if the former isnil.