Python Function with FastAPI: how to debug timeouts with no stacktrace in Application Insights

member45232 51 Reputation points
2022-09-07T21:40:55.823+00:00

99% of you our fastapi requests are in the <500ms response time range. Yet we regularly see single requests that time out with no real pattern. From application insights we do not get a stacktrace or any info on what went wrong within our code. The "work" and logic the backend has to go through for generating the response is minimal, so we can't figure out why it fails sometimes.
How can we find the root cause of the timeouts?
Here is the information we see in Application insights:

EXCEPTION
Microsoft.Azure.WebJobs.Host.FunctionTimeoutException
Exception Properties
Show all
Event time 9/7/2022, 3:17:14.757 PM (Local time)
Message Timeout value of 00:05:00 was exceeded by function: Functions.app
Exception type Microsoft.Azure.WebJobs.Host.FunctionTimeoutException
Failed method Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor+

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,322 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,136 Reputation points Microsoft Employee
    2022-09-11T21:48:45.507+00:00

    This may or may not help but I would start with Application Map. This should help provide insight into the request(s) that's timing out and any associated dependencies with the said request. Storage accounts, databases, custom DNS, even App Insights itself could be issues that's causing your timeout issue.