Skip to content

Conversation

@Frando
Copy link
Member

@Frando Frando commented Dec 5, 2025

Description

This PR changes the qlog configuration such that on the endpoint level, users may supply a QlogFactory, which is invoked for each connection to (optionally) create a QlogConfig for that connection. This means that the usual behavior is now to write a qlog file per connection instead of a single file per endpoint.

This simplifies the operation in quinn_proto: Because a QlogSink is now per connection, we don't have to pass the group_id (which is the initial_dst_cid) for each emitted event, and can instead set it in the so-called CommonFields property of the qlog trace (which allows to set a field for each event in the trace). This will significantly reduce the file size of traces also, and is the recommended practice by the spec.

It will also enable apps to support the QLOGDIR environment variable, so that an endpoint creates a new file for each connection in that directory.

Background

Currently, quinn impls qlog support such that there is one QlogSink per endpoint, shared between all connections. The QlogSink forwards to a qlog::QlogStreamer, which writes events in the JSON-SEQ format. While the events have a group_id field that allows to disambiguate events from different connections, a qlog file in JSON-SEQ format only has a single qlog trace. And according to the spec, a trace logically maps to a single connection. The file in JSON-SEQ format does not allow for multiple traces. The trace-level metadata includes a so-called "vantage point", which is the observed role, so either client or server - a property that makes only sense per connection, not per endpoint.

Breaking Changes

  • removed: TransportConfig::qlog_sink
  • added: TransportConfig::qlog_factory

Notes & open questions

  • With this change, we no longer have a place to emit qlog events unrelated to a connection. However, we currently do not emit any events that don't correlate directly to a connection. Should we happen to add such events in the future, we can extend the QlogFactory trait to create a config for such events.
  • I'm not too keen on the Factory name, but also couldn't come up with better name .

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 21.10553% with 157 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.81%. Comparing base (fb79e91) to head (47880d5).

Files with missing lines Patch % Lines
quinn-proto/src/config/qlog.rs 0.00% 85 Missing ⚠️
quinn-proto/src/connection/qlog.rs 7.01% 53 Missing ⚠️
quinn-proto/src/config/transport.rs 56.66% 13 Missing ⚠️
perf/src/lib.rs 0.00% 4 Missing ⚠️
quinn-proto/src/connection/mod.rs 88.88% 2 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##           Frando/qlog-latest-multipath     #218      +/-   ##
================================================================
- Coverage                         76.01%   75.81%   -0.20%     
================================================================
  Files                                83       84       +1     
  Lines                             23019    23053      +34     
================================================================
- Hits                              17498    17478      -20     
- Misses                             5521     5575      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Frando Frando mentioned this pull request Dec 5, 2025
@Frando Frando requested review from dignifiedquire and flub December 5, 2025 09:05
@n0bot n0bot bot added this to iroh Dec 5, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Dec 5, 2025
Copy link
Collaborator

@Arqu Arqu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@flub
Copy link
Collaborator

flub commented Dec 5, 2025

  • With this change, we no longer have a place to emit qlog events unrelated to a connection. However, we currently do not emit any events that don't correlate directly to a connection. Should we happen to add such events in the future, we can extend the QlogFactory trait to create a config for such events.

Having a look at https://quicwg.org/qlog/draft-ietf-quic-qlog-quic-events.html I could only find the server_listening event? Doesn't seem terribly important I guess. Though surely it's possible to add an endpoint-wide file later too?

@Frando
Copy link
Member Author

Frando commented Dec 5, 2025

Though surely it's possible to add an endpoint-wide file later too?
Yes, that was my thinking too. We can add more functions to the QlogFactory trait for that.

@Frando Frando force-pushed the Frando/qlog-factory branch from 95198c5 to 94dc880 Compare December 5, 2025 11:41
@Frando Frando force-pushed the Frando/qlog-factory branch from 94dc880 to 47880d5 Compare December 5, 2025 11:44
@Frando Frando merged commit 47880d5 into Frando/qlog-latest-multipath Dec 5, 2025
28 checks passed
@Frando Frando deleted the Frando/qlog-factory branch December 5, 2025 12:59
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Dec 5, 2025
dignifiedquire pushed a commit to n0-computer/iroh that referenced this pull request Dec 7, 2025
This adds `qlog` support to iroh. Depends on
n0-computer/quinn#218.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants