File tree Expand file tree Collapse file tree 6 files changed +101
-0
lines changed
Expand file tree Collapse file tree 6 files changed +101
-0
lines changed Original file line number Diff line number Diff line change 1+ TOKEN "read" READ
2+ TAGS "pagerduty"
3+
4+ NODE incident_metrics
5+ SQL >
6+ %
7+ SELECT
8+ count() as total_incidents,
9+ countIf(event_type = 'incident.escalated') * 100.0 / count() as escalation_rate,
10+ countIf(event_type = 'incident.resolved') * 100.0 / count() as resolution_rate
11+ FROM pagerduty
12+ WHERE event.event.data.type::String = 'incident'
13+ AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}}
14+ AND event_time <= {{DateTime(date_to, '2024-12-31 23:59:59')}}
Original file line number Diff line number Diff line change 1+ TOKEN "read" READ
2+ TAGS "pagerduty"
3+
4+ NODE incidents_over_time
5+ SQL >
6+ %
7+ SELECT
8+ toStartOfHour(event_time) as hour,
9+ event_type,
10+ count() as count
11+ FROM pagerduty
12+ WHERE event.event.data.type::String = 'incident'
13+ AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}}
14+ AND event_time <= {{DateTime(date_to, '2024-12-31 23:59:59')}}
15+ GROUP BY hour, event_type
16+ ORDER BY hour DESC
Original file line number Diff line number Diff line change 1+ TOKEN "read" READ
2+ TAGS "pagerduty"
3+
4+ NODE resolution_times
5+ SQL >
6+ %
7+ SELECT
8+ avg(dateDiffSeconds(
9+ parseDateTimeBestEffort(event.event.data.resolved_at),
10+ parseDateTimeBestEffort(event.event.data.created_at)
11+ )) as avg_time_to_resolve,
12+ avg(dateDiffSeconds(
13+ parseDateTimeBestEffort(event.event.data.last_status_change_at),
14+ parseDateTimeBestEffort(event.event.data.created_at)
15+ )) as avg_time_to_last_update
16+ FROM pagerduty
17+ WHERE event_type = 'incident.resolved'
18+ AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}}
19+ AND event_time <= {{DateTime(date_to, '2024-12-31 23:59:59')}}
Original file line number Diff line number Diff line change 1+ TOKEN "read" READ
2+ TAGS "pagerduty"
3+
4+ NODE responders
5+ SQL >
6+ %
7+ SELECT
8+ event.event.agent.summary as responder,
9+ count() as responses,
10+ avg(dateDiffSeconds(
11+ parseDateTimeBestEffort(event.event.data.created_at),
12+ parseDateTimeBestEffort(event.event.occurred_at)
13+ )) as avg_response_time
14+ FROM pagerduty
15+ WHERE event_type = 'incident.acknowledged'
16+ AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}}
17+ AND event_time <= {{DateTime(date_to, '2024-12-31 23:59:59')}}
18+ GROUP BY responder
19+ ORDER BY responses DESC
Original file line number Diff line number Diff line change 1+ TOKEN "read" READ
2+ TAGS "pagerduty"
3+
4+ NODE service_distribution
5+ SQL >
6+ %
7+ SELECT
8+ event.event.data.service.summary as service,
9+ count() as incidents,
10+ countIf(event.event.data.urgency::String = 'high') as high_urgency,
11+ round(avg(event.event.data.urgency::String = 'high') * 100, 2) as high_urgency_rate
12+ FROM pagerduty
13+ WHERE event_type = 'incident.triggered'
14+ AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}}
15+ AND event_time <= {{DateTime(date_to, '2024-12-31 23:59:59')}}
16+ GROUP BY service
17+ ORDER BY incidents DESC
Original file line number Diff line number Diff line change 1+ TOKEN "read" READ
2+ TAGS "pagerduty"
3+
4+ NODE status_distribution
5+ SQL >
6+ %
7+ SELECT
8+ event_type,
9+ count() as count,
10+ round(count() * 100.0 / sum(count()) OVER (), 2) as percentage
11+ FROM pagerduty
12+ WHERE event.event.data.type = 'incident'
13+ AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}}
14+ AND event_time <= {{DateTime(date_to, '2024-12-31 23:59:59')}}
15+ GROUP BY event_type
16+ ORDER BY count DESC
You can’t perform that action at this time.
0 commit comments