Skip to main content

Overview

Get all incident groups in triage for a given source by using an IncidentGroupsFilter, one page at a time. For each incident in the incident groups, write its start and end time, severity, value, and deviation to a CSV file.

Steps

1

Get incident groups for a page

Create a function that takes a client, a source ID, a cursor, and a page limit. The function sends the query for that cursor, returning up to page_limit incident groups. By default, end_cursor is None, which starts from the first record.
2

Create a CSV writer

Create a CSV writer, and write the header to the file.
3

Loop over all pages

Start a loop that runs as long as the API reports another page. Each response has an end cursor, which you pass to get_incident_groups as after so the next page starts from that point. For more on how pagination works, see Pagination and filtering.
4

Write the incidents to file

Iterate over all incident groups on the page and write their incidents to the CSV file.

Full code sample

Python