-
Notifications
You must be signed in to change notification settings - Fork 239
Add adr-9: Replace logging and error reporting infrastructure with tracing #6157
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
base: main
Are you sure you want to change the base?
Conversation
docs/adr/0008-use-tracing.md
Outdated
|
||
Desktop has a [hand-written xpcom-based log adaptor](https://searchfox.org/mozilla-central/source/services/sync/golden_gate/src/log.rs#119-120). This would be removed entirely and a uniffi-based callback mechanism is used. Rust code calling back into Javascript has the same semantics as `golden_gate` - the log calls are "fire and forget", ending up in the main thread automatically. | ||
|
||
The [`gecko-logger`](https://searchfox.org/mozilla-central/source/xpcom/rust/gecko_logger/src/lib.rs) crate would change: |
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.
This makes me so happy! 🙌🏼 I felt like the "log sink" pattern started out as a stopgap to connect Rust bookmark sync to Sync's logging machinery, and it was easy for us to generalize once we started adding more Rust components. It's wonderful to revisit it from the ground up 😁
Thanks for the comment so far - I pushed a new commit with the suggestions here. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6157 +/- ##
=======================================
Coverage 84.08% 84.08%
=======================================
Files 117 117
Lines 15629 15629
=======================================
Hits 13141 13141
Misses 2488 2488 ☔ View full report in Codecov by Sentry. |
One key different in this model which I need to call out in the doc is that something needs to opt-in to each target. eg, in the logging world, you can arrange to see logs from, say, dogear, without taking any specific action regarding that crate. However, in this model, something is going to need to explicitly opt-in to the On one hand that's quite a PITA, but OTOH, this is really what makes this viable - there's really no concept of a "global listener for all events". Does that change the balance for anyone? |
That all makes sense to me, and I like the new behavior change! |
Me as well. The text changes are also looking great. Should we send this out to a larger audience? |
This looks great! Just wanted to add some extra context here :) We've been using So, as another minor pro, the adoption of Tracing will make folks with past experience on Tracing feel right at home when they work on app-services. |
1f7c192
to
0d287a5
Compare
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 great to me. I left a few comments that I think could improve this, but in terms of the ADR -- I'm totally on board and excited to make the move.
docs/adr/0008-use-tracing.md
Outdated
None identified for mobile - but is not implemented at all for Desktop. | ||
|
||
The opportunity is to better align the logging and error-reporting requirements into a single facility while introducing this capability | ||
to desktop. In the first instance, we will arrange for Javascript code running in Desktop Firefox to be notified on such reports, |
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.
After thinking about this a bit more, I'm not sure this needs to be the first step. How about removing the "In the first instance..." part and just keeping the "However, a final decision about what it does with them is TBD."
docs/adr/0008-use-tracing.md
Outdated
simple logging via the `console` facilities. Error reports would initially be logged to the console, with a followup being to decide how to report them externally. | ||
|
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.
Would we still need both gecko-logger
and app-services-logger
? I'm having a hard time seeing the entire pipeline here. Could you spell it out somehow? I'd love to see something like [AppServicesComponent]
-> tracing
-> rust-log-forwarder
-> app-services-logger?
-> gecko-logger?
-> JS console
. A mermaid diagram would be amazing.
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'll update the ADR, but to answer this specific question: rust-log-forwarder
will not be used on desktop and app-services-logger
will be deleted. gecko-logger
will remain but only for existing Rust code in the tree and will not be used at all for logging generated by app-services components.
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.
This seems like a fantastic change and don't see any major blockers or concerns with moving to this!
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! 🚀
Rendered
Putting this up as a draft for internal feedback, after which I'll share it more widely (but feel free to share it as you see fit and/or add additional reviewers)