-
Notifications
You must be signed in to change notification settings - Fork 57
New logging output #4424
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
Merged
Merged
New logging output #4424
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploying matrix-authentication-service-docs with
|
Latest commit: |
b9ae522
|
Status: | ✅ Deploy successful! |
Preview URL: | https://0ce1c82d.matrix-authentication-service-docs.pages.dev |
Branch Preview URL: | https://quenting-better-logging.matrix-authentication-service-docs.pages.dev |
This means we can log stats about the job when it finishes, and its status will have the right log context attached to it.
75705b9
to
76adf18
Compare
reivilibre
approved these changes
Apr 23, 2025
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.
exciting! Looks very plausible, if there's anything minor that needs improvement I'm sure this can happen in a subsequent PR
- what unit is cpu_time in - reduce the number of digits when logging timings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This completely overhauls how we log things.
First, it introduces a new task-level
LogContext
, which records task-level metrics, as well as a unique task ID.This context is then logged when present, making it easier to correlate logs with the task that generated them.
For now, the log context only records the number of polls, the overall task duration and the CPU time used, but we could add more metrics in the future. I'm just trying to keep this PR "small".
Then, there is a new custom event formatter, which includes this log context, but also customizes how log looks in general.
Importantly, it doesn't include context from the spans anymore. This cleans up the log a lot, but may mean we're missing some context in some cases. I've done my best to restore said context, but it's not perfect.
One goal was to remove any
#[instrument(err)]
annotations. Two main reasons for this:#[instrument(err)]
logs the error description and that's it. We loose a lot of information from the error stackThis is mostly replaced by a
record_error!
macro, which also decides whether the error is a warning or not.For now, I've kept some
#[instrument(err)]
annotations in themas-matrix-synapse
andmas-storage-pg
crates, as they are almost always 'internal'/bad errors that we want to log, and this PR is already massive.Last but not least, we finally have a log entry for every single HTTP request 🎉
Fixes #2238
This can be reviewed commit by commit, even though some things are not exactly in the right order.