qlog: merge event category and name (#5329)

This follows a (not so recent) change to the qlog specification.
This commit is contained in:
Marten Seemann
2025-09-07 17:40:45 +08:00
committed by GitHub
parent 2dfd4dd6bf
commit 6dcac15a12
4 changed files with 61 additions and 127 deletions

View File

@@ -14,8 +14,7 @@ type mevent struct{}
var _ eventDetails = mevent{}
func (mevent) Category() category { return categoryConnectivity }
func (mevent) Name() string { return "mevent" }
func (mevent) Name() string { return "foobar:mevent" }
func (mevent) IsNil() bool { return false }
func (mevent) MarshalJSONObject(enc *gojay.Encoder) { enc.StringKey("event", "details") }
@@ -34,7 +33,7 @@ func TestEventMarshaling(t *testing.T) {
require.Len(t, decoded, 3)
require.Equal(t, 1.337, decoded["time"])
require.Equal(t, "connectivity:mevent", decoded["name"])
require.Equal(t, "foobar:mevent", decoded["name"])
require.Contains(t, decoded, "data")
data, ok := decoded["data"].(map[string]any)