-
Notifications
You must be signed in to change notification settings - Fork 49
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
Start using tracing #1515
base: master
Are you sure you want to change the base?
Start using tracing #1515
Conversation
My main motivation for pushing this one out is to use it as a discussion starter to ask some questions. Q1: Are there requirements for the log record formatting? When I ran the server locally, it seemed to output the same data, but some of the field names changed, some things were formatted slightly differently and some new fields were added. Are the changes okay or should are there things that shouldn't change? Current code, JSON format: {"Logger":"syncserver-0.14.4","Type":"syncserver:log","Hostname":"fedora","Pid":419763,"Severity":6,"Timestamp":1705678149057992749,"Fields":{"msg":"{\"ua.os.family\":\"Other\",\"ua.browser.ver \":\"curl\",\"ua\":\"curl\",\"ua.browser.family\":\"Other\",\"uri.method\":\"GET\",\"ua.name\":\"HTTP Library\",\"uri.path\":\"/\",\"ua.os.ver\":\"UNKNOWN\"}"}} New code, JSON format: {"Timestamp":1705681287289443786,"type":"<unknown>","Logger":"syncserver-0.14.4","Hostname":"fedora","EnvVersion":"2.0","Pid":448168,"Severity":5,"Fields":{"slog.column":13,"spans":"","slog.target":"syncserver::tokenserver::logging","slog.line":25,"slog.module_path":"syncserver::tokenserver::logging","message":"{\"ua.os.ver\":\"UNKNOWN\",\"ua.os.family\":\"Other\",\"ua.browser.ver\": \"curl\",\"ua\":\"curl\",\"ua.name\":\"HTTP Library\",\"ua.browser.family\":\"Other\",\"uri.path\":\"/\",\"uri.method\":\"GET\"}","slog.file":"syncserver/src/tokenserver/logging.rs"}} Current code, human format:
New code, human format (now with some green coloring on my terminal):
Q2: do logs always output to stdout or is there some other transport I should test? Q3: Should we add the {"Timestamp":1705689281848618996,"type":"request.summary","Logger":"syncserver-0.14.4","Hostname":"fedora","EnvVersion":"2.0","Pid":532652,"Severity":5,"Fields":{"t_ns":7328717,"t":7,"rid":"8d3c457a-0594-4fb8-ae85-3c017d664d9d","path":"/","agent":"curl/8.2.1","code":302,"spans":"request","method":"GET"}} |
f736218
to
5bbd383
Compare
Q1For now, I'll focus on the JSON logging output. "Human" is just that, and is designed to be human readable, so pretty much whatever format you want to use is fine, provided it's readable. The JSON logs are consumed by several processes, so those should have a structured form. The current logging uses MozLog Services format which is a bit crufty, but explains some of the major key titles and roles. I note that the proposed version includes a new field, We should also check to see if including the Q2As far as the app is concerned, logs are output via stdout. The ingestion tools read those log lines. We would need to coordinate with SRE and the teams that use those logs to ensure that we are not introducing any bugs or potential alerts. Q3We should probably limit the items that we are writing to stdout, or at the very least, ensure that our |
I think I'm not sure what can be done for
I think I'll just remove that. The plan is to remove slog anyways, so I don't think there's much reason to keep around the extra slog metadata.
I'm thinking I should remove this too. The only reason I added it in the first place was the |
5bbd383
to
f5e6b81
Compare
This follows @pjenvey's suggestion to start by switching the app-level logger and forward the slog records from the existing code to tracing events. Depends on: - tracing-slog for slog forwarding - tracing-appender for offloading log writes to a thread - tracing-subscriber as a framework for event subscription/formatting I hand-wrote the code to convert tracing events to MozLog entries, since `tracing-actix-web-mozlog` didn't quite format them how we wanted.
f5e6b81
to
526a010
Compare
Pushed out a second pass at this one. This time I handled the
I also added Here's an example of a log line:
Here's the prettified version:
The I converted the startup log message to using
This is feeling like it's close to correct to me, but I kind of wonder if we're going to need it. There doesn't seem to be much advantage over I personally don't see much use for spans other than simple stuff. It could be nice to group the records for a request together using a span, but it seems like you could do the same thing by adding a |
Description
This follows @pjenvey's suggestion to start by switching the app-level logger and forward the slog records from the existing code to tracing events.
It's based on top of #1514 the
tracing_actix_web_mozlog
crate uses Actix 4.