rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Reorganize `Process` to include extra global states

Open rami3l opened this issue 10 months ago • 2 comments

This was part of the original plan after #3803, but we probably have put it aside for a while:

In https://github.com/rust-lang/rustup/pull/4182#issuecomment-2663126604, I've noticed that the current Process abstraction should probably be extended to allow the existence of a tracing_subscriber global state, so that we can handle graceful shutdown more easily.

Having noticed the clear pattern here:

https://github.com/rust-lang/rustup/blob/52e6070c98ca8f4c26fce9107ff8310323dfa700/src/bin/rustup-init.rs#L44-L53

... it should probably be modeled as an RAII guard.

I have also noticed that this should resolve another problem, i.e. the corresponding construct in tests is simply no longer used, as these two functions no longer have a caller:

https://github.com/rust-lang/rustup/blob/52e6070c98ca8f4c26fce9107ff8310323dfa700/src/test.rs#L235-L250

This is most probably caused by the removal of rustup_macros (https://github.com/rust-lang/rustup/pull/3877/commits/d60f0058503954f57786d16e15a2d42f6798e141): indeed, the tests are passing on the CI, but sometimes one might want to run tests with otel on as well.

@djc What do you think?

rami3l avatar Feb 24 '25 14:02 rami3l

Right, I remember we discussed with @rbtcollins whether there was value in the OpenTelemetry support and he argued that it was very helpful for him the few times he needed it. I'm basically still not sure there is much value in the OpenTelemetry support that we've got and apparently may have broken it inadvertently.

I feel like, unless it's used regularly -- and it hasn't been for a few years at this point I guess -- it may be better to remove the feature altogether because it definitely has maintenance costs. Can always add it back when we need it, and I'm not sure fixing it now when we don't is a good way to use our time.

djc avatar Feb 24 '25 16:02 djc

Right, I remember we discussed with @rbtcollins whether there was value in the OpenTelemetry support and he argued that it was very helpful for him the few times he needed it. I'm basically still not sure there is much value in the OpenTelemetry support that we've got and apparently may have broken it inadvertently.

I feel like, unless it's used regularly -- and it hasn't been for a few years at this point I guess -- it may be better to remove the feature altogether because it definitely has maintenance costs. Can always add it back when we need it, and I'm not sure fixing it now when we don't is a good way to use our time.

@djc My mind hasn't changed too much since that discussion: I think we should at least have a way to obtain the timeline view lest some perf-critical regression happens (esp. regarding the diskio module). I don't particularly care what form that timeline view will be implemented, but reading the console traces just... feels wrong in this particular case. OTOH otel does look a bit heavy (we are paying too much for keeping it updated); macOS' Instruments looks good but is not platform-agnostic.

Again I'm looking at something like https://github.com/tokio-rs/console/issues/129, but before that is implemented, maybe we can use another well-known backend such as the Chromium Tracing Tab that's more stable than otel (https://github.com/thoren-d/tracing-chrome).

rami3l avatar Feb 25 '25 02:02 rami3l