Feat/incident custom fields and resolve reason - #64
Open
Kamyki wants to merge 3 commits into
Open
Conversation
Add PAGERDUTY_API_ENDPOINT option (default https://api.pagerduty.com, use https://api.eu.pagerduty.com for EU accounts) and wire it into the PagerDuty client via WithAPIEndpoint. Needed so raw REST calls and the SDK client target the same, configurable host.
Add resolveReason and resolveReasonIncidentID labels to pagerduty_incident_info, sourced from incident.ResolveReason. A merged incident carries resolveReason="merge_resolve_reason" and resolveReasonIncidentID set to the incident it was merged into, allowing merge detection in queries/dashboards.
Add PAGERDUTY_INCIDENT_CUSTOM_FIELDS option listing incident custom field names to expose as labels. Since the list endpoint does not support include[]=custom_fields, values are fetched per incident via a dedicated GET /incidents/{id}/custom_fields/values request (through the SDK client, so auth/endpoint/transport are reused). Each configured field becomes a customfield_<name> label; failures are logged and leave the value empty.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Salutations,
thanks for developing this metrics exporter. For my use case I needed a few improvements and I would like to upstream them if possible.
PagerDuty has separate data centres for hosting EU customers https://support.pagerduty.com/main/docs/service-regions
They claim that they will forward requests to appropriate backend based on auth tokens, but I would like to skip this hop by setting correct endpoint.
When somethings triggers an incident in my PD, it usually triggers a few of them. Responders merge them into one incident to simplify handling outage (I guess there are extra paid options in PD to do it automatically). I would like to group such incidents in my analytics and don't count them as separate issues. Thus I would like to add "resolveReason", "resolveReasonIncidentID" labels. I guess they can be hidden behind feature flag if it breaks backward compatibility.
I have some custom fields set up on my incidents and their values are also useful in later analysis. It seems that go-pagerduty client does not have methods for requesting this data so I added bare http request reusing client's connection.
Let me know what you think.
Best regards,
Kamil