-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: allow nested details fields in pagerduty #3944
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
base: main
Are you sure you want to change the base?
Conversation
e838ea9
to
47a3b07
Compare
4398f8e
to
4200259
Compare
I don't think it is intentional that the default template is valid YAML, it's just meant to be plain text. I'd even argue it's meant to be Markdown. If I understand the use case, you would like to be able to add structured objects (with nesting) to the |
Correct, our teams prefer that so they can add logic on PagerDuty side depending on the field values. |
Have you considered changing // PagerdutyConfig configures notifications via PagerDuty.
type PagerdutyConfig struct {
...
Details map[string]interface{} `yaml:"details,omitempty" json:"details,omitempty"`
} Would this avoid having to embed YAML inside existing YAML? I haven't checked if this will affect existing configurations, but it would be good to understand if this is a better option. |
That was the initial approach I though about. It will create a free style format and would require checking the interfaces one by one as they can be either maps or templated strings. I'm open to experiment with it. |
Curious to know... Is this going forward ? |
I'll update this PR with the suggested |
4200259
to
20fa318
Compare
This change allows nested key/value pair in pageduty configuration when using `Event API V2` integration. The configuration and payload types where changed from `map[string]string` to `map[string]interface{}`. The details map is walked in stages to render all template strings. Fixes prometheus#2477 Fixes prometheus#3218 Signed-off-by: Siavash Safi <[email protected]>
20fa318
to
6fc0d06
Compare
Thinking about this more, using a template like Parsing template results into maps or slices is possible but could be error-prone and we'd need a format for it. details: ...
details_include:
alerts: true
... |
This change allows nested key/value pair in pageduty configuration when using
Event API V2
integration.The configuration and payload types where changed from
map[string]string
tomap[string]interface{}
.The details map is walked in stages to render all template strings.
Fixes #2477
Fixes #3218
Signed-off-by: Siavash Safi [email protected]