microsoft / microsoft/ApplicationInsights-dotnet
Flush doesn't block until messages are actually flushed
@rajkumar-rangaraj is already working on this.
Since Mar 12, 2026.
- Dominant language
- C#
- Stars
- 613
- Forks
- 301
- PR merge metrics
- No merged PRs in 30d
Description
TelemetryClient.Flush() doesn't actually block returning until the messages are flushed. This means if you're want to flush messages during application shutdown (like in Microsoft/ApplicationInsights-aspnetcore#304) then you have to add a Thread.Sleep(1000) which isn't ideal.
It would be nice if there was a blocking version of this API that took an optional timeout, such that it only blocked for the time necessary to flush the events, or the timeout is hit, so that application shutdown doesn't have to be blocked any longer than necessary.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.