Skip to content

Feat/incident custom fields and resolve reason - #64

Open
Kamyki wants to merge 3 commits into
webdevops:mainfrom
Kamyki:feat/incident-custom-fields-and-resolve-reason
Open

Feat/incident custom fields and resolve reason#64
Kamyki wants to merge 3 commits into
webdevops:mainfrom
Kamyki:feat/incident-custom-fields-and-resolve-reason

Conversation

@Kamyki

@Kamyki Kamyki commented Jul 3, 2026

Copy link
Copy Markdown

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.

  1. 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.

  2. 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.

  3. 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

Kamyki added 3 commits July 3, 2026 18:36
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.
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant