@@ -103,7 +103,10 @@ func (th *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
103
103
return func (ctx context.Context , cmd redis.Cmder ) error {
104
104
fn , file , line := funcFileLine ("github.com/redis/go-redis" )
105
105
106
- attrs := make ([]attribute.KeyValue , 0 , 8 )
106
+
107
+ customAttrs := th .conf .attrsFunc (ctx )
108
+
109
+ attrs := make ([]attribute.KeyValue , 0 , len (customAttrs ) + 8 )
107
110
attrs = append (attrs ,
108
111
semconv .CodeFunction (fn ),
109
112
semconv .CodeFilepath (file ),
@@ -116,7 +119,7 @@ func (th *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
116
119
}
117
120
118
121
opts := th .spanOpts
119
- opts = append (opts , trace .WithAttributes (th . conf . attrsFunc ( ctx ) ... ))
122
+ opts = append (opts , trace .WithAttributes (customAttrs ... ))
120
123
opts = append (opts , trace .WithAttributes (attrs ... ))
121
124
122
125
ctx , span := th .conf .tracer .Start (ctx , cmd .FullName (), opts ... )
@@ -136,7 +139,9 @@ func (th *tracingHook) ProcessPipelineHook(
136
139
return func (ctx context.Context , cmds []redis.Cmder ) error {
137
140
fn , file , line := funcFileLine ("github.com/redis/go-redis" )
138
141
139
- attrs := make ([]attribute.KeyValue , 0 , 8 )
142
+ customAttrs := th .conf .attrsFunc (ctx )
143
+
144
+ attrs := make ([]attribute.KeyValue , 0 , len (customAttrs ) + 8 )
140
145
attrs = append (attrs ,
141
146
semconv .CodeFunction (fn ),
142
147
semconv .CodeFilepath (file ),
@@ -150,7 +155,7 @@ func (th *tracingHook) ProcessPipelineHook(
150
155
}
151
156
152
157
opts := th .spanOpts
153
- opts = append (opts , trace .WithAttributes (th . conf . attrsFunc ( ctx ) ... ))
158
+ opts = append (opts , trace .WithAttributes (customAttrs ... ))
154
159
opts = append (opts , trace .WithAttributes (attrs ... ))
155
160
156
161
ctx , span := th .conf .tracer .Start (ctx , "redis.pipeline " + summary , opts ... )
0 commit comments