qlog: rename generation to key_phase on key_updated and key_discarded (#4315)

This commit is contained in:
Marten Seemann 2024-02-08 09:04:23 +07:00 committed by GitHub
parent c22a3c8e6f
commit ab17a5df6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 27 deletions

View file

@ -27,9 +27,9 @@ type ConnectionTracer struct {
UpdatedCongestionState func(CongestionState)
UpdatedPTOCount func(value uint32)
UpdatedKeyFromTLS func(EncryptionLevel, Perspective)
UpdatedKey func(generation KeyPhase, remote bool)
UpdatedKey func(keyPhase KeyPhase, remote bool)
DroppedEncryptionLevel func(EncryptionLevel)
DroppedKey func(generation KeyPhase)
DroppedKey func(keyPhase KeyPhase)
SetLossTimer func(TimerType, EncryptionLevel, time.Time)
LossTimerExpired func(TimerType, EncryptionLevel)
LossTimerCanceled func()

View file

@ -85,14 +85,14 @@ func NewConnectionTracer(w io.WriteCloser, p logging.Perspective, odcid protocol
UpdatedKeyFromTLS: func(encLevel protocol.EncryptionLevel, pers protocol.Perspective) {
t.UpdatedKeyFromTLS(encLevel, pers)
},
UpdatedKey: func(generation protocol.KeyPhase, remote bool) {
t.UpdatedKey(generation, remote)
UpdatedKey: func(keyPhase protocol.KeyPhase, remote bool) {
t.UpdatedKey(keyPhase, remote)
},
DroppedEncryptionLevel: func(encLevel protocol.EncryptionLevel) {
t.DroppedEncryptionLevel(encLevel)
},
DroppedKey: func(generation protocol.KeyPhase) {
t.DroppedKey(generation)
DroppedKey: func(keyPhase protocol.KeyPhase) {
t.DroppedKey(keyPhase)
},
SetLossTimer: func(tt logging.TimerType, encLevel protocol.EncryptionLevel, timeout time.Time) {
t.SetLossTimer(tt, encLevel, timeout)
@ -389,14 +389,14 @@ func (t *connectionTracer) UpdatedKey(generation protocol.KeyPhase, remote bool)
}
now := time.Now()
t.recordEvent(now, &eventKeyUpdated{
Trigger: trigger,
KeyType: keyTypeClient1RTT,
Generation: generation,
Trigger: trigger,
KeyType: keyTypeClient1RTT,
KeyPhase: generation,
})
t.recordEvent(now, &eventKeyUpdated{
Trigger: trigger,
KeyType: keyTypeServer1RTT,
Generation: generation,
Trigger: trigger,
KeyType: keyTypeServer1RTT,
KeyPhase: generation,
})
}
@ -413,12 +413,12 @@ func (t *connectionTracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLe
func (t *connectionTracer) DroppedKey(generation protocol.KeyPhase) {
now := time.Now()
t.recordEvent(now, &eventKeyDiscarded{
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveServer),
Generation: generation,
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveServer),
KeyPhase: generation,
})
t.recordEvent(now, &eventKeyDiscarded{
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveClient),
Generation: generation,
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveClient),
KeyPhase: generation,
})
}

View file

@ -722,7 +722,7 @@ var _ = Describe("Tracing", func() {
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("key_type", "client_handshake_secret"))
Expect(ev).To(HaveKeyWithValue("trigger", "tls"))
Expect(ev).ToNot(HaveKey("generation"))
Expect(ev).ToNot(HaveKey("key_phase"))
Expect(ev).ToNot(HaveKey("old"))
Expect(ev).ToNot(HaveKey("new"))
})
@ -735,7 +735,7 @@ var _ = Describe("Tracing", func() {
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("key_type", "server_1rtt_secret"))
Expect(ev).To(HaveKeyWithValue("trigger", "tls"))
Expect(ev).To(HaveKeyWithValue("generation", float64(0)))
Expect(ev).To(HaveKeyWithValue("key_phase", float64(0)))
Expect(ev).ToNot(HaveKey("old"))
Expect(ev).ToNot(HaveKey("new"))
})
@ -749,7 +749,7 @@ var _ = Describe("Tracing", func() {
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_updated"))
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("generation", float64(1337)))
Expect(ev).To(HaveKeyWithValue("key_phase", float64(1337)))
Expect(ev).To(HaveKeyWithValue("trigger", "remote_update"))
Expect(ev).To(HaveKey("key_type"))
keyTypes = append(keyTypes, ev["key_type"].(string))
@ -796,7 +796,7 @@ var _ = Describe("Tracing", func() {
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_discarded"))
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("generation", float64(42)))
Expect(ev).To(HaveKeyWithValue("key_phase", float64(42)))
Expect(ev).ToNot(HaveKey("trigger"))
Expect(ev).To(HaveKey("key_type"))
keyTypes = append(keyTypes, ev["key_type"].(string))

View file

@ -345,9 +345,9 @@ func (e eventPacketLost) MarshalJSONObject(enc *gojay.Encoder) {
}
type eventKeyUpdated struct {
Trigger keyUpdateTrigger
KeyType keyType
Generation protocol.KeyPhase
Trigger keyUpdateTrigger
KeyType keyType
KeyPhase protocol.KeyPhase
// we don't log the keys here, so we don't need `old` and `new`.
}
@ -359,13 +359,13 @@ func (e eventKeyUpdated) MarshalJSONObject(enc *gojay.Encoder) {
enc.StringKey("trigger", e.Trigger.String())
enc.StringKey("key_type", e.KeyType.String())
if e.KeyType == keyTypeClient1RTT || e.KeyType == keyTypeServer1RTT {
enc.Uint64Key("generation", uint64(e.Generation))
enc.Uint64Key("key_phase", uint64(e.KeyPhase))
}
}
type eventKeyDiscarded struct {
KeyType keyType
Generation protocol.KeyPhase
KeyType keyType
KeyPhase protocol.KeyPhase
}
func (e eventKeyDiscarded) Category() category { return categorySecurity }
@ -378,7 +378,7 @@ func (e eventKeyDiscarded) MarshalJSONObject(enc *gojay.Encoder) {
}
enc.StringKey("key_type", e.KeyType.String())
if e.KeyType == keyTypeClient1RTT || e.KeyType == keyTypeServer1RTT {
enc.Uint64Key("generation", uint64(e.Generation))
enc.Uint64Key("key_phase", uint64(e.KeyPhase))
}
}