Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.94k stars 441 forks source link

Immediately flush fatal exceptions to App Insights #3213

Open brettsam opened 6 years ago

brettsam commented 6 years ago

Since App Insights batches-and-flushes telemetry and also has a fire-and-forget mechanism for flushing, we can't be guaranteed that messages have made it to the service before we kill the process.

We may be able to implement something similar to this comment for things like the "Host thresholds exceeded" message: https://github.com/Microsoft/ApplicationInsights-dotnet/issues/407#issuecomment-318208844.

JasonBSteele commented 6 years ago

Agreed, there should be an implicit Flush for fatal Exceptions. But I believe this should also apply to caught ones explicitly logged with TraceException. Exceptions will hopefully be rare and are very important to capture, and if debugging, see promptly so I think the overhead of flushing them is worth it against the usefulness of getting them quickly.