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) UpdatedCongestionState func(CongestionState)
UpdatedPTOCount func(value uint32) UpdatedPTOCount func(value uint32)
UpdatedKeyFromTLS func(EncryptionLevel, Perspective) UpdatedKeyFromTLS func(EncryptionLevel, Perspective)
UpdatedKey func(generation KeyPhase, remote bool) UpdatedKey func(keyPhase KeyPhase, remote bool)
DroppedEncryptionLevel func(EncryptionLevel) DroppedEncryptionLevel func(EncryptionLevel)
DroppedKey func(generation KeyPhase) DroppedKey func(keyPhase KeyPhase)
SetLossTimer func(TimerType, EncryptionLevel, time.Time) SetLossTimer func(TimerType, EncryptionLevel, time.Time)
LossTimerExpired func(TimerType, EncryptionLevel) LossTimerExpired func(TimerType, EncryptionLevel)
LossTimerCanceled func() 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) { UpdatedKeyFromTLS: func(encLevel protocol.EncryptionLevel, pers protocol.Perspective) {
t.UpdatedKeyFromTLS(encLevel, pers) t.UpdatedKeyFromTLS(encLevel, pers)
}, },
UpdatedKey: func(generation protocol.KeyPhase, remote bool) { UpdatedKey: func(keyPhase protocol.KeyPhase, remote bool) {
t.UpdatedKey(generation, remote) t.UpdatedKey(keyPhase, remote)
}, },
DroppedEncryptionLevel: func(encLevel protocol.EncryptionLevel) { DroppedEncryptionLevel: func(encLevel protocol.EncryptionLevel) {
t.DroppedEncryptionLevel(encLevel) t.DroppedEncryptionLevel(encLevel)
}, },
DroppedKey: func(generation protocol.KeyPhase) { DroppedKey: func(keyPhase protocol.KeyPhase) {
t.DroppedKey(generation) t.DroppedKey(keyPhase)
}, },
SetLossTimer: func(tt logging.TimerType, encLevel protocol.EncryptionLevel, timeout time.Time) { SetLossTimer: func(tt logging.TimerType, encLevel protocol.EncryptionLevel, timeout time.Time) {
t.SetLossTimer(tt, encLevel, timeout) t.SetLossTimer(tt, encLevel, timeout)
@ -389,14 +389,14 @@ func (t *connectionTracer) UpdatedKey(generation protocol.KeyPhase, remote bool)
} }
now := time.Now() now := time.Now()
t.recordEvent(now, &eventKeyUpdated{ t.recordEvent(now, &eventKeyUpdated{
Trigger: trigger, Trigger: trigger,
KeyType: keyTypeClient1RTT, KeyType: keyTypeClient1RTT,
Generation: generation, KeyPhase: generation,
}) })
t.recordEvent(now, &eventKeyUpdated{ t.recordEvent(now, &eventKeyUpdated{
Trigger: trigger, Trigger: trigger,
KeyType: keyTypeServer1RTT, KeyType: keyTypeServer1RTT,
Generation: generation, KeyPhase: generation,
}) })
} }
@ -413,12 +413,12 @@ func (t *connectionTracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLe
func (t *connectionTracer) DroppedKey(generation protocol.KeyPhase) { func (t *connectionTracer) DroppedKey(generation protocol.KeyPhase) {
now := time.Now() now := time.Now()
t.recordEvent(now, &eventKeyDiscarded{ t.recordEvent(now, &eventKeyDiscarded{
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveServer), KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveServer),
Generation: generation, KeyPhase: generation,
}) })
t.recordEvent(now, &eventKeyDiscarded{ t.recordEvent(now, &eventKeyDiscarded{
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveClient), KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveClient),
Generation: generation, KeyPhase: generation,
}) })
} }

View file

@ -722,7 +722,7 @@ var _ = Describe("Tracing", func() {
ev := entry.Event ev := entry.Event
Expect(ev).To(HaveKeyWithValue("key_type", "client_handshake_secret")) Expect(ev).To(HaveKeyWithValue("key_type", "client_handshake_secret"))
Expect(ev).To(HaveKeyWithValue("trigger", "tls")) 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("old"))
Expect(ev).ToNot(HaveKey("new")) Expect(ev).ToNot(HaveKey("new"))
}) })
@ -735,7 +735,7 @@ var _ = Describe("Tracing", func() {
ev := entry.Event ev := entry.Event
Expect(ev).To(HaveKeyWithValue("key_type", "server_1rtt_secret")) Expect(ev).To(HaveKeyWithValue("key_type", "server_1rtt_secret"))
Expect(ev).To(HaveKeyWithValue("trigger", "tls")) 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("old"))
Expect(ev).ToNot(HaveKey("new")) 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.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_updated")) Expect(entry.Name).To(Equal("security:key_updated"))
ev := entry.Event 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(HaveKeyWithValue("trigger", "remote_update"))
Expect(ev).To(HaveKey("key_type")) Expect(ev).To(HaveKey("key_type"))
keyTypes = append(keyTypes, ev["key_type"].(string)) 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.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_discarded")) Expect(entry.Name).To(Equal("security:key_discarded"))
ev := entry.Event 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).ToNot(HaveKey("trigger"))
Expect(ev).To(HaveKey("key_type")) Expect(ev).To(HaveKey("key_type"))
keyTypes = append(keyTypes, ev["key_type"].(string)) keyTypes = append(keyTypes, ev["key_type"].(string))

View file

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