Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename qlog event key_retired to key_discarded #3463

Merged
merged 1 commit into from Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions qlog/event.go
Expand Up @@ -349,16 +349,16 @@ func (e eventKeyUpdated) MarshalJSONObject(enc *gojay.Encoder) {
}
}

type eventKeyRetired struct {
type eventKeyDiscarded struct {
KeyType keyType
Generation protocol.KeyPhase
}

func (e eventKeyRetired) Category() category { return categorySecurity }
func (e eventKeyRetired) Name() string { return "key_retired" }
func (e eventKeyRetired) IsNil() bool { return false }
func (e eventKeyDiscarded) Category() category { return categorySecurity }
func (e eventKeyDiscarded) Name() string { return "key_discarded" }
func (e eventKeyDiscarded) IsNil() bool { return false }

func (e eventKeyRetired) MarshalJSONObject(enc *gojay.Encoder) {
func (e eventKeyDiscarded) MarshalJSONObject(enc *gojay.Encoder) {
if e.KeyType != keyTypeClient1RTT && e.KeyType != keyTypeServer1RTT {
enc.StringKey("trigger", "tls")
}
Expand Down
10 changes: 5 additions & 5 deletions qlog/qlog.go
Expand Up @@ -428,22 +428,22 @@ func (t *connectionTracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLe
t.mutex.Lock()
now := time.Now()
if encLevel == protocol.Encryption0RTT {
t.recordEvent(now, &eventKeyRetired{KeyType: encLevelToKeyType(encLevel, t.perspective)})
t.recordEvent(now, &eventKeyDiscarded{KeyType: encLevelToKeyType(encLevel, t.perspective)})
} else {
t.recordEvent(now, &eventKeyRetired{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveServer)})
t.recordEvent(now, &eventKeyRetired{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveClient)})
t.recordEvent(now, &eventKeyDiscarded{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveServer)})
t.recordEvent(now, &eventKeyDiscarded{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveClient)})
}
t.mutex.Unlock()
}

func (t *connectionTracer) DroppedKey(generation protocol.KeyPhase) {
t.mutex.Lock()
now := time.Now()
t.recordEvent(now, &eventKeyRetired{
t.recordEvent(now, &eventKeyDiscarded{
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveServer),
Generation: generation,
})
t.recordEvent(now, &eventKeyRetired{
t.recordEvent(now, &eventKeyDiscarded{
KeyType: encLevelToKeyType(protocol.Encryption1RTT, protocol.PerspectiveClient),
Generation: generation,
})
Expand Down
6 changes: 3 additions & 3 deletions qlog/qlog_test.go
Expand Up @@ -757,7 +757,7 @@ var _ = Describe("Tracing", func() {
var keyTypes []string
for _, entry := range entries {
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_retired"))
Expect(entry.Name).To(Equal("security:key_discarded"))
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("trigger", "tls"))
Expect(ev).To(HaveKey("key_type"))
Expand All @@ -773,7 +773,7 @@ var _ = Describe("Tracing", func() {
Expect(entries).To(HaveLen(1))
entry := entries[0]
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_retired"))
Expect(entry.Name).To(Equal("security:key_discarded"))
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("trigger", "tls"))
Expect(ev).To(HaveKeyWithValue("key_type", "server_0rtt_secret"))
Expand All @@ -786,7 +786,7 @@ var _ = Describe("Tracing", func() {
var keyTypes []string
for _, entry := range entries {
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("security:key_retired"))
Expect(entry.Name).To(Equal("security:key_discarded"))
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("generation", float64(42)))
Expect(ev).ToNot(HaveKey("trigger"))
Expand Down