qlogwriter: add support for event_schemas in the trace header (#5361)

This commit is contained in:
Marten Seemann
2025-10-09 12:07:23 +08:00
committed by GitHub
parent 33af12712e
commit c26e86c547
7 changed files with 62 additions and 10 deletions

View File

@@ -12,6 +12,9 @@ import (
"github.com/quic-go/quic-go/qlogwriter"
)
// EventSchema is the qlog event schema for QUIC
const EventSchema = "urn:ietf:params:qlog:events:quic-12"
// DefaultConnectionTracer creates a qlog file in the qlog directory specified by the QLOGDIR environment variable.
// File names are <odcid>_<perspective>.sqlog.
// Returns nil if QLOGDIR is not set.
@@ -35,7 +38,12 @@ func DefaultConnectionTracer(_ context.Context, isClient bool, connID Connection
log.Printf("Failed to create qlog file %s: %s", path, err.Error())
return nil
}
fileSeq := qlogwriter.NewConnectionFileSeq(utils.NewBufferedWriteCloser(bufio.NewWriter(f), f), isClient, connID)
fileSeq := qlogwriter.NewConnectionFileSeq(
utils.NewBufferedWriteCloser(bufio.NewWriter(f), f),
isClient,
connID,
[]string{EventSchema},
)
go fileSeq.Run()
return fileSeq
}