-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
service: prepend the windowsEventLogCore #5298
service: prepend the windowsEventLogCore #5298
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5298 +/- ##
=======================================
Coverage 90.58% 90.58%
=======================================
Files 190 190
Lines 11109 11109
=======================================
Hits 10063 10063
Misses 824 824
Partials 222 222 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a changelog entry
9fecdb0
to
4268dd2
Compare
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description In the CollectorSettings LoggingOptions, when the options are `zap.WrapCore`, the final core wrapped will end up running first. For this reason, the windowsEventLogCore must be the first option in the list of user supplied options, to ensure user supplied options are run before the core that writes to the Windows Event Log. Prior art: I fixed this before in #5298. <!-- Issue number if applicable --> #### Link to tracking issue #5297 <!--Describe what testing was performed and which tests were added.--> #### Testing Testing was manual by running the Collector as a service after this change. I tried to add a unit test but could not find an effective way to do that due to all the type indirection done by the `zap` package. I was hoping to find an easy way to tell that the `windowsEventLogCore` is the first core wrapped in the options but I could not find a way to pull that off. Open to ideas if anyone can find a way.
Description:
When the
windowsEventLogCore
is appended to the logging options, it makes the event log core run before any user specified options. This is undesirable because it means the logs are sent to the event log before any of the user's options are applied. This PR changesnewWithWindowsEventLogCore
to prepending thewindowsEventLogCore
option to the array of LoggingOptions, so it will always run after the user specified options.Link to tracking Issue: #5297
Testing:
make
andmake fmt