Bug 1652558 - Forward Rust tracing events to the Gecko Profiler, emit neqo_glue logs via tracing#5
Open
mxinden-bot wants to merge 2 commits into
Open
Bug 1652558 - Forward Rust tracing events to the Gecko Profiler, emit neqo_glue logs via tracing#5mxinden-bot wants to merge 2 commits into
mxinden-bot wants to merge 2 commits into
Conversation
6a7a6cf to
ae859f9
Compare
…ofiler Add a tracing-subscriber layer in gecko_tracing that mirrors how C++ MOZ_LOG behaves for Rust tracing: - Events are forwarded to the log crate, where GeckoLogger turns them into the same stderr/MOZ_LOG_FILE output and LOGS-category profiler markers a C++ MOZ_LOG call produces. They obey MOZ_LOG and RUST_LOG levels. - Spans are recorded as interval (duration) markers in the profiler only, gated by the same MOZ_LOG levels. Expose gecko_logger::log_enabled (a Rust-visible MOZ_LOG_TEST) so the span path can gate work without going through a log record.
Switch neqo_glue's log call sites (log::debug and the neqo qdebug/qwarn/ qerror macros) over to the tracing macros so that neqo glue logging shows up as profiler markers when profiling. Also wrap neqo_http3conn_process_input and neqo_http3conn_process_output_and_send in entered tracing spans. Because each span stays open for the duration of the call, the profiler records it as an interval marker with a real duration, not just a point-in-time event. The spans carry the byte and segment counts (bytes_received/segments_received and bytes_sent/segments_sent).
ae859f9 to
8168430
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes Rust
tracingevents visible in the Gecko Profiler, and routes neqo_glue's logging throughtracingso it shows up while profiling. Proof of concept for bug 1652558.Changes
xpcom/rust/gecko_tracing/src/profiler.rs(new): atracing-subscriberLayerwhoseon_eventturns each tracing event into a Gecko Profiler text marker viaadd_text_marker.neqo*targets get theNetworkcategory, everything elseOther.xpcom/rust/gecko_tracing/src/lib.rs: installs the layer ininitialize_tracing()(.with(profiler::profiler_layer())), so it is active process-wide. This is the "more sophisticated subscriber" the existing comment already pointed at for this bug.xpcom/rust/gecko_tracing/Cargo.toml: adds thegecko-profilerdependency.netwerk/socket/neqo_glue/src/lib.rs: switches all log call sites (log::debugand the neqoqdebug/qwarn/qerrormacros) totracing::{debug,warn,error}.netwerk/socket/neqo_glue/Cargo.toml: addstracing, drops the now-unusedlog.Cargo.lock: updated dependency lists.Result
Recording a profile now surfaces neqo_glue's log lines as Network-category markers. Any other Rust code emitting
tracingevents benefits automatically.Notes
./mach build); review only.neqo-transportconnection logs totracing; those flow into the same profiler layer once neqo is bumped.Generated by Claude Code