Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

NLog ApplicationInsightsTarget Flush with async delay#176

Merged
SergeyKanzhelev merged 5 commits intomicrosoft:developfrom
snakefoot:develop
Apr 19, 2018
Merged

NLog ApplicationInsightsTarget Flush with async delay#176
SergeyKanzhelev merged 5 commits intomicrosoft:developfrom
snakefoot:develop

Conversation

@snakefoot
Copy link
Copy Markdown
Contributor

@snakefoot snakefoot commented Apr 18, 2018

But only when something to flush. Partially resolves #177 for NLog (Probably also an issue for all other logging destinations)

@SergeyKanzhelev
Copy link
Copy Markdown
Contributor

Thank you for another contribution. We appreciate it.

For the housekeeping purposes - can you please create an issue with the problem description and then include changelog update in PR that would refer this issue.

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Apr 18, 2018

@SergeyKanzhelev Updated changelog for you. And created issue #177

Copy link
Copy Markdown
Contributor

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a disappointment we need to work around this here, not make it a feature of base SDK (microsoft/ApplicationInsights-dotnet#482). I appreciate your contribution and working around current limitations!

else
{
// Documentation says it is important to wait after flush, else nothing will happen
// https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#flushing-data
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove en-US from link so it will direct to localized version of the doc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

{
// Documentation says it is important to wait after flush, else nothing will happen
// https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#flushing-data
System.Threading.Tasks.Task.Delay(500).ContinueWith((task) => asyncContinuation(null));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use TimeSpan.FromMilliseconds(500) to make code a little bit more self-explanatory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@SergeyKanzhelev
Copy link
Copy Markdown
Contributor

I'll wait for other people to chime in and will merge tomorrow

@snakefoot
Copy link
Copy Markdown
Contributor Author

It's a disappointment we need to work around this here, not make it a feature of base SDK

Yes it is a little weird not to have proper flush-logic in a logging framework.

@SergeyKanzhelev SergeyKanzhelev merged commit 388ff8e into microsoft:develop Apr 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NLog ApplicationInsightsTarget Flush should wait for completion

2 participants