transport/pico: PicoQuicXLogSink — route picoquic internal logs through folly XLOG#256
Draft
gmarzot wants to merge 1 commit into
Draft
transport/pico: PicoQuicXLogSink — route picoquic internal logs through folly XLOG#256gmarzot wants to merge 1 commit into
gmarzot wants to merge 1 commit into
Conversation
…rough folly XLOG Adds a 4th picoquic_unified_logging_t implementation alongside textlog/ binlog/qlog. The struct's 14 callbacks emit XLOG(...) at appropriate severities so picoquic's internal events become operator-controllable via the standard --logging=quic.picoquic=... config under the unified logging story (openmoq/moqx#339). Installation is opt-in: callers do moxygen::openmoq::pico::installPicoQuicXLogSink(quic); which assigns the static kXLogBackend struct to quic->text_log_fns, mirroring exactly what picoquic_set_qlog does for its slot. Mutually exclusive with picoquic_set_textlog (same slot); qlog and binlog remain available in parallel. Severity mapping: INFO app_message hooks (deliberate app-level logs) DBG1 connection lifecycle, ALPN, drops, losses DBG2 transport params, TLS ticket, CC dump DBG3 per-packet (pdu in/out, decrypted/outgoing packet) The implementation reaches into picoquic_internal.h to write the text_log_fns slot directly (same pattern qlog_fns.c uses). CMake target gets ${picoquic_SOURCE_DIR}/picoquic on its include path via the BUILD_INTERFACE trick already used for picohttp. PoC scope: - 14 callbacks all emit minimal informative lines (cid + key fields) - log_cc_dump emits a placeholder; richer CC snapshot can come once we pick stable picoquic accessors for rtt/cwnd/ssthresh. Refs: openmoq/moxygen notes/picoquic-logging-bridge.md
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
PoC bringing picoquic's internal C-side logging into the unified folly XLOG story (openmoq/moqx#339), so the picoquic stack participates on equal footing with mvfst once the rest of the normalization lands.
The C++ wrapper at
moxygen/openmoq/transport/pico/already usesXLOG(...)natively. What was missing was a route for picoquic's internal C-side events (per-packet, per-cnx lifecycle, drops, losses, CC, ALPN, etc.) — those flow through picoquic'spicoquic_unified_logging_tabstraction and currently can only be written to text/bin/qlog files, separate from the operator's--logging=knob.This PR adds a 4th implementation of that struct that emits
XLOG(...)instead of writing to a file, plus an opt-in installer.How it plugs in
Picoquic stores three pointers (
text_log_fns,bin_log_fns,qlog_fns) inpicoquic_quic_t, one per output mode. Existing setters wire them up via direct assignment, e.g. fromloglib/qlog_fns.c:PicoQuicXLogSinkmirrors that exactly:kXLogBackendis a process-lifetime constant struct whose 14 fields point atextern "C"callbacks defined in the file. Each formats its event into aXLOG(...)line with the appropriate severity.Severity mapping
log_app_message/log_quic_app_messageINFOlog_new_connection/log_close_connection/log_negotiated_alpnDBG1log_dropped_packet/log_buffered_packet/log_packet_lostDBG1log_transport_extension/log_picotls_ticket/log_cc_dumpDBG2log_pdu/log_packet/log_outgoing_packet(per-packet)DBG3log_quic_closeOperator UX:
--logging=quic.picoquic=INFO→ lifecycle + app messages--logging=quic.picoquic=DBG1→ adds drops, losses, buffered events--logging=quic.picoquic=DBG3→ opens the per-packet firehose(Category root depends on where Alan lands the
quic.{mvfst,picoquic}discussion in #339; this PR doesn't pick it — categories derive from__FILE__per the standardFOLLY_XLOG_STRIP_PREFIXESmechanism.)Internal-header dependency
Reaches into
picoquic_internal.hto write thetext_log_fnsslot — the same access pattern picoquic's own qlog backend uses. The CMake target gets${picoquic_SOURCE_DIR}/picoquicon its include path via the BUILD_INTERFACE trick already used for picohttp.If reviewers prefer a public picoquic API, follow-up could add
picoquic_set_unified_log(quic, fns)to openmoq/picoquic — small patch.Interaction with qlog/binlog
picoquic_set_textlog— same slot (text_log_fns). Users running an XLog sink should not callpicoquic_set_textlog.picoquic_set_qlog(quic, dir)/picoquic_set_binlog(quic, dir). The intended split:--logging=quic.picoquic=DBG2)--qlog-dirflag, consumed by qvis)Opt-in only
Nothing in the existing transport/server init paths is changed. Consumers (
MoQPicoQuicServer,MoQPicoQuicEventBaseServer, etc.) that want the sink callinstallPicoQuicXLogSink(quic)after creating their picoquic context. Default behavior is unchanged.Test plan
-DBUILD_PICOQUIC=ON) compiles the newopenmoq_pico_xlog_sinktarget.--logging=.=INFOshows connection-establish and ALPN lines--logging=quic.picoquic=DBG3shows per-packet output--logging=quic.picoquic=WARNis quiet during steady statepicoquic_set_qlog(quic, "/tmp/qlogs")— confirm qlog files still written; XLog sink output also appears in stderr.DBG1— no regression vs sink-not-installed baseline (async folly LoggerDB should absorb).Refs
notes/picoquic-logging-bridge.md(in openmoq/notes/)notes/logging-test-plan.md(Gate 2 coversquic.picoquic.*)This change is