Skip to main content

Overview

Get a summary of the severities of a source’s incidents without iterating over the incidents themselves. Fetch all incident groups for the last week, page by page, and add up the number of incidents for each severity over the week.

Steps

1

Construct the query

Write the query to fetch incident groups with their severity statistics. Also initialize variables to keep track of the page, the cursor, the time range, and the severity counts.
2

Iterate over the pages

Start a loop that continues as long as there are more pages. Execute the query for each page, with a limit of 1000 elements per page.
3

Add the severity count

Initialize the counts from the first incident group, then add the counts from every later group.
4

Print the result

Once all pages are processed, you have the total count for each severity across the full time range. Print each severity and its number of incidents.

Full code sample

Python