Skip to content

Conversation

@marten-seemann
Copy link
Member

Fixes #4915.

This is an absolutely massive PR, but I don't see any way to split it up into smaller parts.

This PR:

  • Removes the logging package. Logging is done using qlog. This is QUIC, qlog is (or rather, will soon be) an RFC, so it makes soon to use qlog, instead of wrapping it in another abstraction layer.
  • Remove the metrics package. This is temporary. We should offer some kind of metrics tracer, although I'm currently undecided regarding the exact structure.

The new API looks very different from what we had so far. For example, here's how the packet_sent event was triggered previously:

SentLongHeaderPacket func(hdr *ExtendedHeader, size ByteCount, ecn ECN, ack *AckFrame, frames []Frame)
SentShortHeaderPacket func(hdr *ShortHeader, size ByteCount, ecn ECN, ack *AckFrame, frames []Frame)

Now we just pass an qlog.Event to RecordEvent:

type PacketSent struct {
	Header            PacketHeader
	Raw               RawInfo
	Frames            []Frame
	ECN               ECN
	IsCoalesced       bool
	Trigger           string
	SupportedVersions []Version
}

This is a lot more flexible, we can just add fields to the PacketSent struct, and define how they're marshalled.

This new qlog API will allow us, among others:

  • Support more fine-grained qlog events, as described above.
  • Support qlog for protocols building on top of QUIC, e.g. HTTP/3 (see http3: add qlog support #4124)

@marten-seemann marten-seemann changed the title Qlog writer qlog: implement a new API, remove logging.Tracer and logging.ConnectionTracer Oct 6, 2025
@marten-seemann marten-seemann changed the title qlog: implement a new API, remove logging.Tracer and logging.ConnectionTracer qlog: implement a new API, remove logging abstraction layer Oct 6, 2025
@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 73.98971% with 354 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.07%. Comparing base (c9d3778) to head (427fd27).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
connection.go 77.51% 68 Missing and 6 partials ⚠️
connection_logging.go 47.37% 65 Missing and 5 partials ⚠️
internal/handshake/crypto_setup.go 5.48% 64 Missing and 5 partials ⚠️
server.go 72.54% 53 Missing ⚠️
transport.go 46.34% 20 Missing and 2 partials ⚠️
internal/ackhandler/sent_packet_handler.go 81.52% 13 Missing and 4 partials ⚠️
qlog/event.go 88.80% 3 Missing and 11 partials ⚠️
qlogwriter/writer.go 86.17% 8 Missing and 5 partials ⚠️
internal/congestion/cubic_sender.go 46.67% 7 Missing and 1 partial ⚠️
internal/ackhandler/ecn.go 89.80% 5 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5356      +/-   ##
==========================================
- Coverage   84.17%   83.07%   -1.10%     
==========================================
  Files         158      156       -2     
  Lines       18730    18743      +13     
==========================================
- Hits        15765    15570     -195     
- Misses       2346     2555     +209     
+ Partials      619      618       -1     

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

@marten-seemann marten-seemann force-pushed the qlog-writer branch 6 times, most recently from 7966761 to 5a674fd Compare October 6, 2025 07:40
@marten-seemann marten-seemann requested a review from Copilot October 6, 2025 07:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a comprehensive overhaul of the qlog system by removing the logging abstraction layer and establishing qlog as the primary logging mechanism. The changes introduce a new direct qlog API that replaces the previous wrapped abstraction, enabling more flexible and fine-grained event logging for QUIC connections.

Key changes:

  • Removes the logging package abstraction layer in favor of direct qlog usage
  • Introduces new qlog event structures and encoding mechanisms
  • Updates all transport and server components to use the new qlog API
  • Establishes a test utility framework for qlog event recording

Reviewed Changes

Copilot reviewed 86 out of 89 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
transport_test.go Updated test infrastructure to use new qlog event recording system
transport.go Migrated packet handling and tracing to direct qlog event recording
testutils/events/ Added new test utility framework for qlog event recording and verification
server_test.go Converted server tests from mock-based to event recorder-based testing
server.go Updated server packet handling to use qlog event recording
qlogwriter/ New qlog writer infrastructure for JSON-SEQ format output
qlog/ Completely rewritten qlog types and event structures with direct encoding
mtu_discoverer.go Updated MTU discovery to use qlog event recording

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@marten-seemann marten-seemann force-pushed the qlog-writer branch 2 times, most recently from 220e5c6 to 8840215 Compare October 6, 2025 07:55
@marten-seemann marten-seemann requested a review from Copilot October 6, 2025 07:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 86 out of 89 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

qlogwriter/writer.go:1

  • [nitpick] Consider using jsontext.Uint instead of jsontext.Int for StreamID since protocol.StreamID is an unsigned integer type, maintaining type consistency with the underlying protocol definition.
package qlogwriter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@marten-seemann
Copy link
Member Author

I don't think there's a lot we can do about code coverage here. We're not really reducing coverage in any existing files.

@marten-seemann marten-seemann marked this pull request as draft October 6, 2025 16:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@marten-seemann marten-seemann marked this pull request as ready for review October 7, 2025 04:20
@marten-seemann marten-seemann requested a review from Copilot October 7, 2025 05:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 85 out of 88 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

server_test.go:1

  • Corrected spelling of 'adddng' to 'adding'.
package quic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@marten-seemann marten-seemann force-pushed the qlog-writer branch 2 times, most recently from c4a2b2c to b49c9b7 Compare October 7, 2025 13:12
@marten-seemann marten-seemann changed the title qlog: implement a new API, remove logging abstraction layer qlog: split serializiation and events into separate packages, remove logging abstraction layer Oct 8, 2025
@marten-seemann marten-seemann changed the title qlog: split serializiation and events into separate packages, remove logging abstraction layer qlog: split serializiation and event definitions, remove logging abstraction layer Oct 8, 2025
@marten-seemann marten-seemann changed the title qlog: split serializiation and event definitions, remove logging abstraction layer qlog: split serializiation and event definitions, remove logging abstraction Oct 8, 2025
@marten-seemann marten-seemann merged commit c2131eb into master Oct 8, 2025
37 of 38 checks passed
@marten-seemann marten-seemann deleted the qlog-writer branch October 11, 2025 05:58
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.

remove general purpose connection tracer, go all-in on qlog

2 participants