Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add LogEventDropped handler to the NetworkTarget - #5101

#5101
Merged
snakefoot merged 3 commits into
NLog:devNLog/NLog:devfrom
ShadowDancer:5084-network-log-droppingCopy head branch name to clipboard
Nov 17, 2022
Merged

Add LogEventDropped handler to the NetworkTarget#5101
snakefoot merged 3 commits into
NLog:devNLog/NLog:devfrom
ShadowDancer:5084-network-log-droppingCopy head branch name to clipboard

Conversation

@ShadowDancer

@ShadowDancer ShadowDancer commented Nov 8, 2022

Copy link
Copy Markdown
Contributor

Add LogEventDropped handler to the NetworkTarget. Resolves #5084

As proposed in the ticket copied implementation from AsyncTargetWrapper, but had to make a few tweaks due to nature of NetworkTarget (it can discard messages on multiple occasions, due to message size or number of connections).

This MR assumes that NetworkTarget owns and outlives NetworkSender.

Closes #5084

@welcome

welcome Bot commented Nov 8, 2022

Copy link
Copy Markdown

Thanks for opening this pull request!
We will try to review this soon! Please note that pull requests with unit tests are earlier accepted 👼

@snakefoot

Copy link
Copy Markdown
Contributor

@ShadowDancer Thank you for the contribution, and finding all the locations where LogEvents are dropped. Excellent work.

Any reason why the dropped-EventArgs is different from AsyncTargetWrapper ? (Not including the LogEvent)

I recognize that it will give better performance, but curious if the inconsistency is good?

@POnakS

POnakS commented Nov 15, 2022

Copy link
Copy Markdown

@snakefoot QueuedNetworkSender operates on buffers of bytes, it does not have concept of LogEvent (it operates on buffers instead). I've taken simple approach and unified event across all call sites.

I think LogEvent does not matter for this use case, as I want to know if there is backpressure on logshipper - in that case you probably cannot do anything with these logs anyway.

Comment thread src/NLog/Internal/NetworkSenders/QueuedNetworkSender.cs Outdated
Comment thread src/NLog/Targets/NetworkTarget.cs Outdated
This simplifies NetworkTarget logic as it does not make sense to have network target without buffer.
Comment thread src/NLog/Targets/NetworkTarget.cs
Comment thread src/NLog/Targets/LogEventDroppedEventArgs.cs Outdated
Comment thread src/NLog/Targets/LogEventDroppedEventArgs.cs Outdated
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

93.3% 93.3% Coverage
0.0% 0.0% Duplication

@snakefoot snakefoot left a comment

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.

I think it looks good. And thank you for the unit-tests. Any last changes before merging?

@POnakS

POnakS commented Nov 17, 2022

Copy link
Copy Markdown

Not really, go ahead :)

@snakefoot
snakefoot merged commit b1bf791 into NLog:dev Nov 17, 2022
@welcome

welcome Bot commented Nov 17, 2022

Copy link
Copy Markdown

Hooray your first pull request is merged! Thanks for the contribution! Looking for more? 👼 Please check the up-for-grabs issues - thanks!
thanks!

@snakefoot snakefoot changed the title Add LogEventDropped handler to the NetworkTarget (#5084) Add LogEventDropped handler to the NetworkTarget Nov 17, 2022
@snakefoot snakefoot added this to the 5.1 milestone Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce event handler LogEventDropped for NetworkTarget

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.