Service Level calc mismatch with Analytics API interval data

Pulling raw interval data from /api/v2/analytics/queues/summary to calculate Service Level. The metric field shows wait but the value seems to be cumulative wait time, not count of calls. My manual calc (handled_under_sla / total_handled) * 100 is way off from the dashboard.

# Interval data payload
{
 "metric": "wait",
 "type": "count",
 "value": 4500.5 
}

Is there a specific metric key for SLA compliance count or am I missing a filter param?

You’re mixing up wait with handled. The wait metric tracks seconds, not calls. For Service Level, you need the handled metric. Also, the API returns cumulative values for intervals, so you might need to diff them if you aren’t using the group-by parameter correctly.

Here’s how I structure the query in Terraform to get the right data:

data "genesyscloud_analytics_queue_summary" "sla_calc" {
 interval = "2023-10-01T00:00:00.000Z/2023-10-01T01:00:00.000Z"
 metrics = ["handled", "wait"]
 
 filters {
 name = "queue.id"
 type = "in"
 value = [genesyscloud_routing_queue.main.id]
 }
}

Check the handled metric type. It should be count. Divide handled_under_sla by total_handled from that specific metric object. Don’t use the raw wait value for SLA percentages. It’s a common trap when first pulling analytics data.