-
Notifications
You must be signed in to change notification settings - Fork 37
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
telemetry: introduce orb-telemetry crate and use it in orb-ui #258
telemetry: introduce orb-telemetry crate and use it in orb-ui #258
Conversation
0c2fc42
to
6fceae9
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.
I tested and the filtering doesn't seem to work as expected
I have RUST_LOG=debug
in my environment, but the same applies if the default_directive
uses LevelFilter::DEBUG
:
- when filtering out
info
and above levels withjournalctl
, i still have debug logs (ietracing::debug!()
) - these disappear only when I filter out
warning
and above levels 🤔
(venv) (os-b5c3a10) worldcoin@id-faff46c4:/mnt/scratch$ jl -fu worldcoin-ui --priority=info
-- Logs begin at Tue 2023-11-21 21:10:22 UTC. --
Oct 23 08:43:17 localhost worldcoin-ui[2338]: UI event: {"BatteryIsCharging":{"is_charging":true}}
[...]
corresponding line
tracing::debug!("UI event: {}", serde_json::to_string(event)?.as_str());
/// Calling this more than once or when another tracing subscriber is registered | ||
/// will cause a panic. |
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.
should we prevent the panic? return an error instead?
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 think the panic is preferred. This type of code is once-only initialization code. If we called it more than once we should abort.
Generally errors are more for things that actually are expected to happen and need to be robustly handled. But someone calling this twice is better immediately slapped on the wrist and told to change their code.
This is expected, journald has a different naming scheme than the |
should we document this somewhere? 🤔 |
Its already documented by tracing_journald. |
6fceae9
to
d979d84
Compare
we should in general be using journald for our logs, not stdout. Also, we should use stderr instead of stdout.
Every one of our crates sets up logging in a different way, but they all do the same thing. I wanted to introduce a single spot that lets us configure our telemetry. If it goes well in orb-ui, we can use it in all the rest too