With default configuration Application Insights will decide to either sample or not at the beginning of a request and then correspondingly either will collect everything or drop everything. This approach provides some guarantees such as if you're looking at some transaction then you see it entirely, including some downstream components.
You're right that with this approach it is possible miss some errors. Our experience tells that even for high scale applications (5000 RPS / instance) such approach still captures errors if they keep occurring.
There are two things you can to mitigate this:
Collect all exceptions (still will not collect failed requests). For this you can modify the following adaptive sampling section from this:
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<ExcludedTypes>Event</ExcludedTypes>
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<IncludedTypes>Event</IncludedTypes>
</Add>
To:
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<ExcludedTypes>Event,Exception</ExcludedTypes>
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>100</MaxTelemetryItemsPerSecond>
<IncludedTypes>Exception</IncludedTypes>
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<IncludedTypes>Event</IncludedTypes>
</Add>
Note, Application Insights will not necessarily collect failed requests.
- It is possible to write own sampling processor (TelemetryProcessor). For instance, collect failed requests, dependencies, exceptions and for the rest apply own sampling logic.