I have an Azure C# Http triggered function which is an API call that returns a Json payload. The function is run in an Isolated Worker Model and contains several separate async tasks that run concurrently to produce different sections of the said Json payload.
Sometimes these tasks can take longer than expected and because of this consumers of this API call occasionally cancel the request. These API calls will then show up in Application Insights as a request that ends in error (HTTP 499).
The question is how can I have this event logged but not necessarily as an error in Application Insights?
I have tried catching TaskCancelledException on the individual async tasks and the orchestrating trigger function method. I do always catch the exception successfully, log it as information and then return a 200 status code but the request is still showing as an error in Application Insights.
Thanks for any pointers you can give.