Skip to content

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
mainfrom
neqo-glue-tracing-profiler
Open

Bug 1652558 - Forward Rust tracing events to the Gecko Profiler, emit neqo_glue logs via tracing#5
mxinden-bot wants to merge 2 commits into
mainfrom
neqo-glue-tracing-profiler

Conversation

@mxinden-bot

Copy link
Copy Markdown
Owner

Summary

Makes Rust tracing events visible in the Gecko Profiler, and routes neqo_glue's logging through tracing so it shows up while profiling. Proof of concept for bug 1652558.

Changes

  • xpcom/rust/gecko_tracing/src/profiler.rs (new): a tracing-subscriber Layer whose on_event turns each tracing event into a Gecko Profiler text marker via add_text_marker. neqo* targets get the Network category, everything else Other.
  • xpcom/rust/gecko_tracing/src/lib.rs: installs the layer in initialize_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 the gecko-profiler dependency.
  • netwerk/socket/neqo_glue/src/lib.rs: switches all log call sites (log::debug and the neqo qdebug/qwarn/qerror macros) to tracing::{debug,warn,error}.
  • netwerk/socket/neqo_glue/Cargo.toml: adds tracing, drops the now-unused log.
  • 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 tracing events benefits automatically.

Notes

  • Not yet built locally (./mach build); review only.
  • A companion neqo proof of concept switches a couple of key neqo-transport connection logs to tracing; those flow into the same profiler layer once neqo is bumped.

Generated by Claude Code

@mxinden-bot mxinden-bot force-pushed the neqo-glue-tracing-profiler branch 17 times, most recently from 6a7a6cf to ae859f9 Compare June 27, 2026 17:08
mxinden added 2 commits June 30, 2026 12:43
…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).
@mxinden-bot mxinden-bot force-pushed the neqo-glue-tracing-profiler branch from ae859f9 to 8168430 Compare June 30, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants