Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PagerDuty

PagerDuty is an incident management platform that helps teams detect, respond to, and resolve operational issues. The PagerDuty sink delivers your outbox messages as Events API v2 events, which can trigger incidents, route to on-call responders, and integrate with PagerDuty's full incident lifecycle management. This enables your PostgreSQL events to directly drive incident response — when a critical business condition is detected, pg_tide can automatically page the right team.

When to Use This Sink

Choose PagerDuty when critical business events in your PostgreSQL database should trigger immediate human response. Examples include: payment processing failures that need urgent attention, security-relevant events (unauthorized access attempts), SLA violations, or infrastructure conditions detected through database monitoring.

Configuration

SELECT tide.relay_set_outbox(
    'critical-alerts',
    'incidents',
    'pagerduty-relay',
    '{
        "sink_type": "pagerduty",
        "routing_key": "${env:PAGERDUTY_ROUTING_KEY}",
        "severity": "critical",
        "source": "pg-tide",
        "component": "payment-service",
        "dedup_key_field": "dedup_key"
    }'::jsonb
);

Configuration Reference

ParameterTypeDefaultDescription
sink_typestringMust be "pagerduty"
routing_keystringPagerDuty Events API v2 routing (integration) key
severitystring"error"Event severity: "critical", "error", "warning", "info"
sourcestring"pg-tide"Source of the event
componentstringnullComponent or service name
dedup_key_fieldstring"dedup_key"Field to use as PagerDuty dedup key (prevents duplicate incidents)
event_actionstring"trigger"Action: "trigger", "acknowledge", "resolve"

Deduplication

PagerDuty uses deduplication keys to group related events into a single incident. By default, pg_tide uses the outbox message's dedup_key as PagerDuty's dedup key. This means publishing multiple events with the same dedup_key updates the existing incident rather than creating duplicate pages.

Auto-Resolve

You can configure separate pipelines for triggering and resolving incidents:

-- Trigger incidents from error events
SELECT tide.relay_set_outbox('trigger-alerts', 'errors', 'pd-group',
    '{"sink_type": "pagerduty", "routing_key": "${env:PD_KEY}", "event_action": "trigger"}'::jsonb);

-- Resolve incidents from recovery events
SELECT tide.relay_set_outbox('resolve-alerts', 'recoveries', 'pd-group',
    '{"sink_type": "pagerduty", "routing_key": "${env:PD_KEY}", "event_action": "resolve"}'::jsonb);

Troubleshooting

  • "Invalid routing key" — Verify the routing key from your PagerDuty integration settings
  • Duplicate incidents — Check that dedup_key_field maps to a consistent identifier
  • No incidents triggered — Verify the service has an active escalation policy

Further Reading