-
Notifications
You must be signed in to change notification settings - Fork 24
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
Added support for structured logging in csaf_aggregator
#530
Conversation
This PR adds structured logging for the aggregator service. Currently, only the text handler is used, but I can extend this to use the JSON handler as well. In this case, probably some code that is shared between the aggregator and the downloader would need to be moved to a common package. I was also wondering, whether this repo is moving to Go 1.21 at the future, since `slog` was introduced in to the standard lib in 1.21. So currently, this still relies on the `x/exp` package. Fixes gocsaf#462
Thank for your contribution. I will review the PR as soon as I've git some time.
We clearly can do this as we already where there. The 'x/exp' stuff was only introduced in PR #514 to help backwards compatibility. |
Looking forward to the feedback!
Ah I see. Well it should be more or less a case of just replacing the exp package with the |
csaf_aggretator
csaf_aggregator
Just a reminder: When we update the Go version, this also needs to be documented in https://github.com/csaf-poc/csaf_distribution/blob/main/README.md#build-from-sources and https://github.com/csaf-poc/csaf_distribution/blob/main/docs/Development.md#supported-go-versions as well. |
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.
I tested this briefly and it seems to work. I didn't check all the changed log statements, though.
@oxisto a side question about Github: Is it possible for your to run the "Integration Test" workflow (https://github.com/oxisto/csaf_distribution/blob/main/.github/workflows/itest.yml ) because obviously I cannot do this on your clone and as it is not part of our automatic test I have not figured out how to run it on a pull request manually). |
@oxisto in one commit message you are asking a few questions (which ideally shouldn't be in a commit message):
It should be similar to how the downloader handels it.
Yes common code should go into a common package, we already have util. Both can be done in different PRs. |
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.
LGTM and works.
A symbolic link is called symbol
twice, I recommend to change this.
Removing the verbose
command line option and adding setting for the log-level would be the next step, however it might also affect the command line, so it can be delayed.
Sure, once this is merged I can have a look at what can be extracted into a common package, so that other tools can potentially use this as well and that behaviour is consistent across Apart from that I have changed the symbol to sym link. |
https://github.com/oxisto/csaf_distribution/actions/runs/8821657205/job/24218013269 |
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.
works and LGTM
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.
Looks good to me now
This PR adds structured logging for the aggregator service. Currently, only the text handler is used, but I can extend this to use the JSON handler as well. In this case, probably some code that is shared between the aggregator and the downloader would need to be moved to a common package.
I was also wondering, whether this repo is moving to Go 1.21 at the future, since
slog
was introduced in to the standard lib in 1.21. So currently, this still relies on thex/exp
package.Fixes #462