How to suppress/hide exceptions in application insights from azue api management?

Pooja Gupta 20 Reputation points Microsoft Employee
2023-05-23T20:47:28.1266667+00:00

Issue is mainly for ClientConnectionFailure exceptions as it seems they occur when the client drops the connection. How can we ignore/handle this and not log as exception in telemetry as this is valid exception?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,760 questions
{count} votes

Accepted answer
  1. navba-MSFT 17,120 Reputation points Microsoft Employee
    2023-05-30T05:03:57.47+00:00

    [@Pooja Gupta](/@Pooja Gupta ](https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-app-insights#performance-implications-and-log-sampling)Thanks for reaching out to the Microsoft Q&A forum. I see that your ask is regarding handling the ClientConnectionFailure error from being logged in to the Application insights logs.

    There are multiple reasons why ClientConnectionFailure could occur:
    "ClientConnectionFailure" occurs when the client application that initiates the call with APIM abandons the request before completion. When this happens, APIM drops everything it was doing and logs a Client Connection Failure message. These failures generally occurs when the request is taking too long to complete so the client either gives up (a user may close the browser) or the client application may have a time out. APIM has no control on when or why the client decides to abandon the request. So technically this is not an APIM issue.

    As mentioned in the below table, the ClientConnection failure is logged in the Application inights as an Exception telemetry item:
    User's image

    More Info here.

    You can enable the Application Insights it at the API level or at the Global level as shown below:

    User's image

    This will only log exceptions that have a severity level of "Error" or higher, which includes exceptions with HTTP status codes matching 4xx or 5xx. At times the ClientConnection failure will have status code ZERO (0). This will not be logged then. However, If it has status code of 4XX or 5XX it will be logged.

    Alternatively, To avoid the ClientConnection exception while analyzing your Application insights logs, you could filter this while querying the Exceptions telemetry using the concerned operation-id as shown below:

    User's image

    On a side note, please be aware of the performance implications on APIM with enabling App Insights.


0 additional answers

Sort by: Most helpful