Hi, I’m new to Compass and it looks pretty promising! We are pushing our events and metrics manually via the APIs since the tools we’re using don’t directly integrate with Compass. Everything has been working pretty well, using GraphQL is new to me but I managed to get through the setup using the documentation provided.
One thing I’m struggling with is that I created some test events initially, specifically Incidents. It looks like those incidents are still marked as “open” so they’re showing up in the “Recent Incidents” count. The requests to update the incident require the Incident ID, but unfortunately I didn’t note down Incident ID. Now I can’t find this data anywhere so I can’t resolve the created incidents. Is there a way to list all open incidents, get their ids and close them via REST requests?
After a few hours of trying different things and strong support from ChatGPT, I managed to find the incident ids with:
query fetchIncidentIds($cloudId: ID!, $externalEventSourceId: ID!) {
compass {
eventSource(
cloudId: $cloudId,
externalEventSourceId: $externalEventSourceId,
eventType: INCIDENT
) {
... on EventSource {
events {
... on CompassEventConnection {
nodes {
displayName
... on CompassIncidentEvent {
incidentProperties {
id
}
}
}
}
}
}
}
}
}
With query variables:
{
"cloudId": "...",
"externalEventSourceId": "..."
}
I’m leaving it here in case anyone comes looking.
Possibly a better way:
query fetchIncidentIds($componentId: ID!, $eventTypes: [CompassEventType!]) {
compass {
component(id: $componentId) {
... on CompassComponent {
id
events(query: {eventTypes: $eventTypes}) {
... on CompassEventConnection {
nodes {
... on CompassEvent {
displayName,
eventType
}
... on CompassIncidentEvent {
incidentProperties {id, state, startTime, endTime}
}
}
}
}
}
}
}
}
{
"componentId": "...",
"eventTypes": ["INCIDENT"]
}