diff --git a/tracer.go b/tracer.go index d9a81e2..4011477 100644 --- a/tracer.go +++ b/tracer.go @@ -54,7 +54,7 @@ func (m *hookTracer) OnProduceRecordBuffered(r *kgo.Record) { omd, ok := metadata.FromOutgoingContext(r.Context) if !ok { - omd = metadata.New(0) + omd = metadata.New(len(r.Headers)) } md := metadata.Copy(omd) @@ -121,7 +121,7 @@ func (m *hookTracer) OnFetchRecordBuffered(r *kgo.Record) { } omd, ok := metadata.FromIncomingContext(r.Context) if !ok { - omd = metadata.New(0) + omd = metadata.New(len(r.Headers)) } md := metadata.Copy(omd)