@@ -117,42 +117,60 @@ func resourceToJaegerProtoProcess(resource pdata.Resource) *model.Process {
117117 process := model.Process {}
118118 if serviceName , ok := attrs .Get (conventions .AttributeServiceName ); ok {
119119 process .ServiceName = serviceName .StringVal ()
120- attrs .Delete (conventions .AttributeServiceName )
121120 }
122- process .Tags = attributesToJaegerProtoTags (attrs )
121+ process .Tags = resourceAttributesToJaegerProtoTags (attrs )
123122 return & process
124123
125124}
126125
127- func attributesToJaegerProtoTags (attrs pdata.AttributeMap ) []model.KeyValue {
126+ func resourceAttributesToJaegerProtoTags (attrs pdata.AttributeMap ) []model.KeyValue {
128127 if attrs .Cap () == 0 {
129128 return nil
130129 }
131130
132131 tags := make ([]model.KeyValue , 0 , attrs .Cap ())
133132 attrs .ForEach (func (key string , attr pdata.AttributeValue ) {
134- tag := model.KeyValue {Key : key }
135- switch attr .Type () {
136- case pdata .AttributeValueSTRING :
137- // Jaeger-to-Internal maps binary tags to string attributes and encodes them as
138- // base64 strings. Blindingly attempting to decode base64 seems too much.
139- tag .VType = model .ValueType_STRING
140- tag .VStr = attr .StringVal ()
141- case pdata .AttributeValueINT :
142- tag .VType = model .ValueType_INT64
143- tag .VInt64 = attr .IntVal ()
144- case pdata .AttributeValueBOOL :
145- tag .VType = model .ValueType_BOOL
146- tag .VBool = attr .BoolVal ()
147- case pdata .AttributeValueDOUBLE :
148- tag .VType = model .ValueType_FLOAT64
149- tag .VFloat64 = attr .DoubleVal ()
133+ if key == conventions .AttributeServiceName {
134+ return
150135 }
151- tags = append (tags , tag )
136+ tags = append (tags , attributeToJaegerProtoTag ( key , attr ) )
152137 })
153138 return tags
154139}
155140
141+ func attributesToJaegerProtoTags (attrs pdata.AttributeMap ) []model.KeyValue {
142+ if attrs .Cap () == 0 {
143+ return nil
144+ }
145+
146+ tags := make ([]model.KeyValue , 0 , attrs .Cap ())
147+ attrs .ForEach (func (key string , attr pdata.AttributeValue ) {
148+ tags = append (tags , attributeToJaegerProtoTag (key , attr ))
149+ })
150+ return tags
151+ }
152+
153+ func attributeToJaegerProtoTag (key string , attr pdata.AttributeValue ) model.KeyValue {
154+ tag := model.KeyValue {Key : key }
155+ switch attr .Type () {
156+ case pdata .AttributeValueSTRING :
157+ // Jaeger-to-Internal maps binary tags to string attributes and encodes them as
158+ // base64 strings. Blindingly attempting to decode base64 seems too much.
159+ tag .VType = model .ValueType_STRING
160+ tag .VStr = attr .StringVal ()
161+ case pdata .AttributeValueINT :
162+ tag .VType = model .ValueType_INT64
163+ tag .VInt64 = attr .IntVal ()
164+ case pdata .AttributeValueBOOL :
165+ tag .VType = model .ValueType_BOOL
166+ tag .VBool = attr .BoolVal ()
167+ case pdata .AttributeValueDOUBLE :
168+ tag .VType = model .ValueType_FLOAT64
169+ tag .VFloat64 = attr .DoubleVal ()
170+ }
171+ return tag
172+ }
173+
156174func spanToJaegerProto (span pdata.Span ) (* model.Span , error ) {
157175 if span .IsNil () {
158176 return nil , nil
0 commit comments