๐Ÿ”ง DevOps

PagerDuty

An incident management and response platform

Detailed Explanation

PagerDuty is a real-time incident management and on-call scheduling platform founded in 2009. It collects alerts generated by monitoring systems and immediately delivers them to the appropriate person through various channels such as phone calls, SMS, push notifications, and email, dramatically reducing incident response time (MTTR).

Its core feature is the Escalation Policy. If the first-level responder does not respond within 15 minutes, the alert is automatically escalated to the second-level responder, and if there is still no response, to the team lead. This prevents critical incidents from being left unattended.

PagerDuty integrates with more than 400 monitoring tools (Prometheus, Datadog, CloudWatch, Grafana, etc.) and automatically groups duplicate alerts to reduce alert fatigue. On average, it reduces alert noise by more than 70%.

In practice, it is used for on-call rotation management, incident timeline recording, and post-mortem automation. With the SLA management feature, you can set policies such as responding to P1 (Critical) incidents within 5 minutes and P2 within 30 minutes, and track compliance.

Code Example

# PagerDuty API๋ฅผ ํ†ตํ•œ ์ธ์‹œ๋˜ํŠธ ์ƒ์„ฑ (curl)
curl -X POST https://events.pagerduty.com/v2/enqueue \
  -H 'Content-Type: application/json' \
  -d '{
    "routing_key": "YOUR_INTEGRATION_KEY",
    "event_action": "trigger",
    "dedup_key": "db-connection-failure-prod",
    "payload": {
      "summary": "[CRITICAL] Production DB connection pool exhausted",
      "severity": "critical",
      "source": "production-api-server-01",
      "timestamp": "2024-01-15T09:30:00.000Z",
      "component": "database",
      "group": "production",
      "class": "connection_failure",
      "custom_details": {
        "active_connections": 100,
        "max_connections": 100,
        "waiting_queries": 250,
        "error_rate": "45%",
        "affected_services": ["user-api", "payment-api", "order-api"]
      }
    },
    "links": [
      {
        "href": "https://grafana.company.com/d/db-metrics",
        "text": "Grafana Dashboard"
      }
    ],
    "images": [
      {
        "src": "https://grafana.company.com/render/d-solo/db-metrics?panelId=1"
      }
    ]
  }'

# Python SDK๋กœ ์ธ์‹œ๋˜ํŠธ ๊ด€๋ฆฌ
# pip install pdpyras
from pdpyras import APISession

session = APISession('YOUR_API_KEY')

# ์˜จ์ฝœ ๋‹ด๋‹น์ž ์กฐํšŒ
oncall = session.get('/oncalls', params={
    'schedule_ids[]': ['PSCHEDULE1'],
    'since': '2024-01-15T00:00:00Z',
    'until': '2024-01-15T23:59:59Z'
})

for entry in oncall.json()['oncalls']:
    print(f"ํ˜„์žฌ ์˜จ์ฝœ: {entry['user']['name']}")
    print(f"์—ฐ๋ฝ์ฒ˜: {entry['user']['email']}")

# ์ธ์‹œ๋˜ํŠธ ์ž๋™ ํ•ด๊ฒฐ
session.post('/incidents', json={
    'incident': {
        'type': 'incident',
        'title': 'Auto-resolved: DB connection pool recovered',
        'service': {'id': 'PSERVICE1', 'type': 'service_reference'},
        'status': 'resolved'
    }
})

How It's Said in Practice

Senior: "We had an escalation failure during last week's early-morning incident. Did you recheck the PagerDuty settings?"

Junior: "Yes, I checked, and the second-level responder's contact information was empty. I've now made it mandatory to add a backup responder to the on-call rotation as well."

Interviewer: "Do you have on-call experience? What tools did you use?"

Candidate: "I was on call once a week using PagerDuty. By fine-tuning the escalation policy, I reduced the MTTR for P1 incidents from 15 minutes to 8 minutes, and I also greatly improved alert fatigue by grouping duplicate alerts."

Take a mock interview on this topic โ†’ WIA SOOM AI Interview ยท Start for free

Reviewer: "Sending this monitoring alert to PagerDuty is fine, but if you don't set a dedup_key, dozens of alerts can go off for the same incident."

Developer: "Ah, you're right. I'll build the dedup_key from the service name and error type to prevent duplicate alerts."

Cautions

Learn More