@@ -103,7 +103,10 @@ func (th *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
103103 return func (ctx context.Context , cmd redis.Cmder ) error {
104104 fn , file , line := funcFileLine ("github.com/redis/go-redis" )
105105
106- attrs := make ([]attribute.KeyValue , 0 , 8 )
106+
107+ customAttrs := th .conf .attrsFunc (ctx )
108+
109+ attrs := make ([]attribute.KeyValue , 0 , len (customAttrs ) + 8 )
107110 attrs = append (attrs ,
108111 semconv .CodeFunction (fn ),
109112 semconv .CodeFilepath (file ),
@@ -116,7 +119,7 @@ func (th *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
116119 }
117120
118121 opts := th .spanOpts
119- opts = append (opts , trace .WithAttributes (th . conf . attrsFunc ( ctx ) ... ))
122+ opts = append (opts , trace .WithAttributes (customAttrs ... ))
120123 opts = append (opts , trace .WithAttributes (attrs ... ))
121124
122125 ctx , span := th .conf .tracer .Start (ctx , cmd .FullName (), opts ... )
@@ -136,7 +139,9 @@ func (th *tracingHook) ProcessPipelineHook(
136139 return func (ctx context.Context , cmds []redis.Cmder ) error {
137140 fn , file , line := funcFileLine ("github.com/redis/go-redis" )
138141
139- attrs := make ([]attribute.KeyValue , 0 , 8 )
142+ customAttrs := th .conf .attrsFunc (ctx )
143+
144+ attrs := make ([]attribute.KeyValue , 0 , len (customAttrs ) + 8 )
140145 attrs = append (attrs ,
141146 semconv .CodeFunction (fn ),
142147 semconv .CodeFilepath (file ),
@@ -150,7 +155,7 @@ func (th *tracingHook) ProcessPipelineHook(
150155 }
151156
152157 opts := th .spanOpts
153- opts = append (opts , trace .WithAttributes (th . conf . attrsFunc ( ctx ) ... ))
158+ opts = append (opts , trace .WithAttributes (customAttrs ... ))
154159 opts = append (opts , trace .WithAttributes (attrs ... ))
155160
156161 ctx , span := th .conf .tracer .Start (ctx , "redis.pipeline " + summary , opts ... )
0 commit comments