@@ -95,9 +95,6 @@ func parseRUMRequestIntoResource(resource pcommon.Resource, payload map[string]a
9595 prettyPayload , _ := json .MarshalIndent (payload , "" , "\t " )
9696 resource .Attributes ().PutStr ("pretty_payload" , string (prettyPayload ))
9797
98- bodyDump := resource .Attributes ().PutEmptyBytes ("request_body_dump" )
99- bodyDump .FromRaw (rawRequestBody )
100-
10198 // Store URL query parameters as attributes
10299 queryAttrs := resource .Attributes ().PutEmptyMap ("request_query" )
103100 for paramName , paramValues := range req .URL .Query () {
@@ -161,51 +158,58 @@ func flattenJSON(payload map[string]any) map[string]any {
161158}
162159
163160func setAttributes (flatPayload map [string ]any , attributes pcommon.Map ) {
164- for rumKey , meta := range attributeMetaMap {
165- val , exists := flatPayload [rumKey ]
166- if ! exists {
167- continue
161+ for key , val := range flatPayload {
162+ meta , exists := attributeMetaMap [key ]
163+
164+ rumKey := ""
165+ typ := StringAttribute
166+ if exists {
167+ rumKey = meta .OTLPName
168+ typ = meta .Type
169+ } else {
170+ rumKey = "datadog" + "." + key
171+ typ = StringAttribute
168172 }
169173
170- switch meta . Type {
174+ switch typ {
171175 case StringAttribute :
172176 if s , ok := val .(string ); ok {
173- attributes .PutStr (meta . OTLPName , s )
177+ attributes .PutStr (rumKey , s )
174178 }
175179 case BoolAttribute :
176180 if b , ok := val .(bool ); ok {
177- attributes .PutBool (meta . OTLPName , b )
181+ attributes .PutBool (rumKey , b )
178182 }
179183 case NumberAttribute :
180184 if f , ok := val .(float64 ); ok {
181- attributes .PutDouble (meta . OTLPName , f )
185+ attributes .PutDouble (rumKey , f )
182186 }
183187 case IntegerAttribute :
184188 if i , ok := val .(int64 ); ok {
185- attributes .PutInt (meta . OTLPName , i )
189+ attributes .PutInt (rumKey , i )
186190 } else if f , ok := val .(float64 ); ok {
187191 i := int64 (f )
188- attributes .PutInt (meta . OTLPName , i )
192+ attributes .PutInt (rumKey , i )
189193 }
190194 case ObjectAttribute :
191195 if o , ok := val .(map [string ]any ); ok {
192- objVal := attributes .PutEmptyMap (meta . OTLPName )
196+ objVal := attributes .PutEmptyMap (rumKey )
193197 for k , v := range o {
194198 objVal .PutStr (k , fmt .Sprintf ("%v" , v ))
195199 }
196200 }
197201 case ArrayAttribute :
198202 if a , ok := val .([]any ); ok {
199- arrVal := attributes .PutEmptySlice (meta . OTLPName )
203+ arrVal := attributes .PutEmptySlice (rumKey )
200204 for _ , v := range a {
201205 arrVal .AppendEmpty ().SetStr (fmt .Sprintf ("%v" , v ))
202206 }
203207 }
204208 case StringOrArrayAttribute :
205209 if s , ok := val .(string ); ok {
206- attributes .PutStr (meta . OTLPName , s )
210+ attributes .PutStr (rumKey , s )
207211 } else if a , ok := val .([]any ); ok {
208- arrVal := attributes .PutEmptySlice (meta . OTLPName )
212+ arrVal := attributes .PutEmptySlice (rumKey )
209213 for _ , v := range a {
210214 arrVal .AppendEmpty ().SetStr (fmt .Sprintf ("%v" , v ))
211215 }
0 commit comments