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

Add CustomDetails field to PagerDuty #65

Merged
merged 6 commits into from
Mar 15, 2023

Conversation

santihernandezc
Copy link
Contributor

This PR enables users to add custom details to their PagerDuty integrations.

This field is an object containing arbitrary key-value pairs (docs). The field name is custom_details, as shown in the example payload in PagerDuty's docs.

These details get merged with the default ones we're already sending. In case of a duplicate key, the user-defined value for that key prevails.

Note: we should consider using a map[string]interface{} instead of map[string]string as we're currently doing. In the example I linked above, it's clear that the values in this object may not be always strings.

receivers/pagerduty/config_test.go Show resolved Hide resolved
receivers/pagerduty/config.go Outdated Show resolved Hide resolved
@alexweav
Copy link
Contributor

It seems there is also some handling of this field that prometheus does, and our notifier does not seem to do. Specifically, if the overall request is too big and will be rejected by PD, it makes sure to trim the custom details before anything else.

If we are going to make this field editable, let's consider handling it the same way?
https://github.com/prometheus/alertmanager/blob/41eb1213bb1c7ce0aa9e6464e297976d9c81cfe5/notify/pagerduty/pagerduty.go#L126-L142

Copy link
Contributor

@yuri-tceretian yuri-tceretian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great job

@santihernandezc santihernandezc merged commit d1e3c68 into main Mar 15, 2023
@santihernandezc santihernandezc deleted the santihernandezc/add_custom_details_to_pagerduty branch March 15, 2023 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants