@@ -3,6 +3,7 @@ package traceloop
33import (
44 "context"
55 "fmt"
6+ "maps"
67
78 semconvai "github.com/traceloop/go-openllmetry/semconv-ai"
89 "github.com/traceloop/go-openllmetry/traceloop-sdk/model"
@@ -78,15 +79,17 @@ func (workflow *Workflow) NewAgent(name string, associationProperties map[string
7879 semconvai .TraceloopEntityName .String (name ),
7980 }
8081
82+ agentAssociationProps := make (map [string ]string , len (associationProperties )+ 1 )
83+ maps .Copy (agentAssociationProps , associationProperties )
84+
8185 if workflow .Attributes .ABTest != nil {
8286 for key , activeVariant := range workflow .Attributes .ABTest .VariantKeys {
8387 if activeVariant {
84- associationProperties ["ab_testing_variant" ] = key
88+ agentAssociationProps ["ab_testing_variant" ] = key
8589 }
8690 }
8791 }
88- // Add agent-specific association properties to the span
89- for key , value := range associationProperties {
92+ for key , value := range agentAssociationProps {
9093 attrs = append (attrs , attribute .String ("traceloop.association.properties." + key , value ))
9194 }
9295
@@ -98,7 +101,7 @@ func (workflow *Workflow) NewAgent(name string, associationProperties map[string
98101 ctx : aCtx ,
99102 Attributes : AgentAttributes {
100103 Name : name ,
101- AssociationProperties : associationProperties ,
104+ AssociationProperties : agentAssociationProps ,
102105 },
103106 }
104107}
0 commit comments