-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
internal: Simplify logger #12631
internal: Simplify logger #12631
Conversation
I'm still not happy with this ... |
out of curiosity, what would make you happier with logging in rust-analyzer? happy to point you in the right direction. |
I am not quite sure yet :) For one I want to remove the I am still a bit uncertain how to properly make use of tracing for our needs here, but in general we want to move our profiling stuff to tracing #3794 and I am very much unsure how to interoperate that with our current tracing logging. I am still quite unsure about how to properly leverage tracing for all these things I think, I tried myself at that issue twice now I think, I unfortunately do not remember what the concrete problems where that I run into but at this point I am a bit too annoyed to try again and I also kind of lost sight of how to approach that issue 😅 |
That's fair. Like you alluded, if you want that dependency to emit logs that
Naively, I'd add a target/field for things values that you intend profile with, but I think for the performance overhead of tracing when profiling, we'd like to land a change that avoids boxing extensions in the Registry. I've tried to find an issue on |
So (I think) ideally we would want to just be able to slap Ideally all we have is really just tracing and no extra stuff I think. |
(Sorry for the delay in responding; I thought I responded five days ago!)
You've got two options:
Both these options need to be used with https://docs.rs/tracing-subscriber/latest/tracing_subscriber/reload/index.html to live-reload the filters. I think for performance in profiling to be more reasonable, we (on the tracing side of things) should implement tokio-rs/tracing#2230, which should reduce some of the overhead reported in the Bevy issue I linked to (if that overhead is okay for y'all, then that's great! If not, I can try to prioritize this change.) |
(since I got pinged) If you want help configuring filtering to select the events you want, please do open a discussion on tracing-filter. The domain for tracing-filter is quite literally to enable whatever span/event filtering/selection anybody could possibly want, so having people actually try to use it is a great boon. The current state of tracing-filter is just that it can do anything log's envfilter1 or tracing-subscriber's envfilter2 can do, and doing more is being worked on. Necessary disclaimer: tracing-filter is still alpha software. However,
Footnotes
|
Alright, thansk for you guys' input, very much appreciated. I'll try out tracing-filter and see where that goes. Fwiw for profiling we currently allow filtering specific (non-tracing) spans by their name and the duration they took. So for example we can say |
Filtering to events inside selected span(s) is something that IIRC EnvFilter can't do1, but is absolutely on the roadmap for tracing-filter's full functionality. Filtering by duration is not something I had considered, but is something obviously useful that I'm kinda sad I overlooked as a possibility. For tracing-filter's initial development push, this is out of scope; it just provides a normal as-they-come-in filter, and it's not possible to go back in time2 to include a span('s children) if it takes more than a time threshold. What this does indicate though is something which can be addressed: querying not just metadata and record fields, but also extension data recorded by subscriber layers. This might require integration into tracing-subscriber and using Profiling mostly wants to serialize the tracing data and filter it post facto, which is outside the domain of tracing (and e.g. in the domain of OpenTelemetry). However, I do want to (in a future milestone) allow tracing-filter to also be used to filter recorded tracing data, though doing so will be quite involved due to the differences between having the tracing-subscriber registry and not4. I hope that sort of helps clarify where tracing-filter is positioned? Footnotes
|
Another go at https://github.com/rust-lang/rust-analyzer/pull/11625/files
From the looks of it, removing the
tracing-log
interop layer works out fine for us since all ourlog
usages are using static paths anyways it seems (and we don't have a lot of things actively depending onlog
).