-
Notifications
You must be signed in to change notification settings - Fork 860
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
chore(dist/features): ship tracing
and friends by default
#3803
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
I think we should use a basic console-based tracing-subscriber setup: pub(super) fn subscribe() -> tracing::subscriber::DefaultGuard {
let sub = tracing_subscriber::FmtSubscriber::builder()
.with_max_level(tracing::Level::TRACE)
.with_writer(|| TestWriter)
.finish();
tracing::subscriber::set_default(sub)
}
struct TestWriter;
impl Write for TestWriter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
print!(
"{}",
str::from_utf8(buf).expect("tried to log invalid UTF-8")
);
Ok(buf.len())
}
fn flush(&mut self) -> io::Result<()> {
io::stdout().flush()
}
} This is what I've been using in Quinn for many years. Every test just starts by calling If we do this we can massively simplify the scaffolding for traces/logging:
|
I don't think this is true. We've not asked people to build with otel enabled that I'm remembering. The OS level traces we use to debug fundamental problems are from strace / truss and other similar tools. Otel / tracing! is not deployed widely enough within rustup to be a replacement for such things. |
Please don't - while the OS level debugging is vital, for doing investigations on performance, having a nice report with spans and the detailed call tree is very useful, and since we configure it off by default it has very little overhead to maintain or build with. Really only the all-features-build test matters. |
How many times have you used it in the past year? IMO while custom test macro + opentelemetry dependencies may not impose run-time overhead for downstream users, it does impose significant maintenance overhead that may not be warranted for the additional insight compared to just tracing-subscriber built-in (and maybe tokio-console level output). |
IMO the important point is that we should have a user-facing solution like "enable RUST_LOG=trace and give us the output of that", which seems like a decent method of getting better insight into problems that happen only in specific environments, which seems to be an important source of issues for rustup. |
I just checked and it looks like tokio-console doesn’t currently have a timeline view (tokio-rs/console#129), so I imagine For now I plan to:
More specifically, I imagine having multiple subscribers (tokio-rs/tracing#971) based on env vars and features:
Finally:
Waiting for #3367 might be worthwhile, since this will change the startup process. |
f50ac2f
to
2ff50f8
Compare
#3367 has been merged, would be good to rebase this! |
Part of #3790.
Rationale
Currently, helping out the Rustup team by enabling local tracing is quite a tedious process (esp. for community contributors), requiring rebuilding Rustup from the exact commit with an extra feature,
otel
:rustup/doc/dev-guide/src/tracing.md
Lines 13 to 36 in 54dd3d0
After some experiment, it turned out that we actually can ship the tracing features by default without forcing the user to face OTEL connection errors on a daily basis.
To clarify, this does not mean Rustup is setting up a central (a.k.a. phone-home-style) telemetry mechanism, and we will keep the tracing disabled by default unless
RUST_LOG
has been explicitly set.Concerns
RUSTUP_DEBUG
in favor ofRUST_LOG=trace
? (Yes.)Should we remove(Not yet, see chore(dist/features): shipopentelemetry
while keepingtracing
(refactor(download): remove curl backend #3788 (comment))? If we should, theotel
feature should be renamed.tracing
and friends by default #3803 (comment).)