forked from quic-go/quic-go
logging / qlog: add support for DPLPMTUD (#4517)
* logging / qlog: add support for DPLPMTUD * improve the MTU discovery integration test
This commit is contained in:
@@ -76,6 +76,9 @@ func NewConnectionTracer(w io.WriteCloser, p logging.Perspective, odcid protocol
|
||||
LostPacket: func(encLevel protocol.EncryptionLevel, pn protocol.PacketNumber, lossReason logging.PacketLossReason) {
|
||||
t.LostPacket(encLevel, pn, lossReason)
|
||||
},
|
||||
UpdatedMTU: func(mtu logging.ByteCount, done bool) {
|
||||
t.UpdatedMTU(mtu, done)
|
||||
},
|
||||
UpdatedCongestionState: func(state logging.CongestionState) {
|
||||
t.UpdatedCongestionState(state)
|
||||
},
|
||||
@@ -367,6 +370,10 @@ func (t *connectionTracer) LostPacket(encLevel protocol.EncryptionLevel, pn prot
|
||||
})
|
||||
}
|
||||
|
||||
func (t *connectionTracer) UpdatedMTU(mtu protocol.ByteCount, done bool) {
|
||||
t.recordEvent(time.Now(), &eventMTUUpdated{mtu: mtu, done: done})
|
||||
}
|
||||
|
||||
func (t *connectionTracer) UpdatedCongestionState(state logging.CongestionState) {
|
||||
t.recordEvent(time.Now(), &eventCongestionStateUpdated{state: congestionState(state)})
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ var _ = Describe("Tracing", func() {
|
||||
Expect(m).To(HaveKey("title"))
|
||||
Expect(m).To(HaveKey("trace"))
|
||||
trace := m["trace"].(map[string]interface{})
|
||||
Expect(trace).To(HaveKey(("common_fields")))
|
||||
Expect(trace).To(HaveKey("common_fields"))
|
||||
commonFields := trace["common_fields"].(map[string]interface{})
|
||||
Expect(commonFields).To(HaveKeyWithValue("ODCID", "deadbeef"))
|
||||
Expect(commonFields).To(HaveKeyWithValue("group_id", "deadbeef"))
|
||||
@@ -723,6 +723,17 @@ var _ = Describe("Tracing", func() {
|
||||
Expect(ev).To(HaveKeyWithValue("trigger", "reordering_threshold"))
|
||||
})
|
||||
|
||||
It("records MTU discovery updates", func() {
|
||||
tracer.UpdatedMTU(1337, true)
|
||||
tracer.Close()
|
||||
entry := exportAndParseSingle(buf)
|
||||
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
|
||||
Expect(entry.Name).To(Equal("recovery:mtu_updated"))
|
||||
ev := entry.Event
|
||||
Expect(ev).To(HaveKeyWithValue("mtu", float64(1337)))
|
||||
Expect(ev).To(HaveKeyWithValue("done", true))
|
||||
})
|
||||
|
||||
It("records congestion state updates", func() {
|
||||
tracer.UpdatedCongestionState(logging.CongestionStateCongestionAvoidance)
|
||||
tracer.Close()
|
||||
|
||||
@@ -294,6 +294,20 @@ type metrics struct {
|
||||
PacketsInFlight int
|
||||
}
|
||||
|
||||
type eventMTUUpdated struct {
|
||||
mtu protocol.ByteCount
|
||||
done bool
|
||||
}
|
||||
|
||||
func (e eventMTUUpdated) Category() category { return categoryRecovery }
|
||||
func (e eventMTUUpdated) Name() string { return "mtu_updated" }
|
||||
func (e eventMTUUpdated) IsNil() bool { return false }
|
||||
|
||||
func (e eventMTUUpdated) MarshalJSONObject(enc *gojay.Encoder) {
|
||||
enc.Uint64Key("mtu", uint64(e.mtu))
|
||||
enc.BoolKey("done", e.done)
|
||||
}
|
||||
|
||||
type eventMetricsUpdated struct {
|
||||
Last *metrics
|
||||
Current *metrics
|
||||
|
||||
Reference in New Issue
Block a user