Prefect

task_runs/count API endpoint timeout prevents UI rendering

warning
performanceUpdated Jul 13, 2025(via Exa)
Technologies:
How to detect:

The api/task_runs/count endpoint takes 10+ seconds to respond, sometimes exceeding 10-second timeout threshold. Endpoint returns total count of all task_runs in database (observed: 8.4+ million records) even when UI requests only recent time range (e.g., Past day). UI remains completely blank during wait.

Recommended action:

Monitor api/task_runs/count endpoint response times using prefect.server.api.request.duration metric. Set alerts for requests exceeding 5 seconds. Review database indexes on task_runs table. Consider implementing count query scoping to match UI filter selections. Check related issue #16299 for database performance remediation and #19347 for endpoint-specific fixes.