-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use tracing fields to store variable log data #134
Use tracing fields to store variable log data #134
Conversation
This greatly assists when analyzing errors using a tool like Google's Log Analytics. See the root-level documentation of tracing for more explanation on the merits of doing this: https://docs.rs/tracing/latest/tracing/#recording-fields
Hey, first of all, you don't have to convince me that structured tracing/logging is great :) When I started this crate it was actually using old Generally it looks good, but I need a bit more time to review when I have time, so I'll come back to you. |
PS Also it fails on tests/compilation in pipelines :) |
This is exactly what happened to us, so I completely understand!
Absolutely! Given the nature of the PR, it's not exactly urgent. Thanks again. :) |
I'm trying to test all the features enabled:
|
Yikes, sorry about that! |
In some places, it looks a bit now repetitive since we have tracing spans, etc:
I guess for some cases some people might want both, so I'll leave it for now. I'm going to merge this, thanks for contributions! 👍🏻 |
Hey again!
This PR goes through all of the places that the crate uses tracing events and pushes all of the variable data into fields.
This is something that we recently did for our backend services, and it made it far easier to analyze our logs using Google's Log Analytics tool. We're also able to easily pull out data from these fields, which is helpful not only for Log Analytics, but for log-based metrics!
We actually run our services with debug-level logging enabled for the firestore crate in order to get better insight into the behavior and performance of the database, and track down cases of transaction contention, which is why I've made this PR.
The root-level documentation of tracing has additional explanation of the merits of using fields here.
Below is an example of what this looks like in Log Analytics for one of our services. This maybe isn't the best example because I've picked a small sample so I didn't have to draw so many black boxes, but you can see where some firestore events haven't been grouped.
Thank you for your continued, high quality work on this project!