@@ -50,6 +50,19 @@ var datadogKnownResourceAttributes = map[string]string{
50
50
"kube_namespace" : semconv .AttributeK8SNamespaceName ,
51
51
"pod_name" : semconv .AttributeK8SPodName ,
52
52
53
+ // HTTP
54
+ "http.client_ip" : semconv .AttributeClientAddress ,
55
+ "http.response.content_length" : semconv .AttributeHTTPResponseBodySize ,
56
+ "http.status_code" : semconv .AttributeHTTPResponseStatusCode ,
57
+ "http.request.content_length" : semconv .AttributeHTTPRequestBodySize ,
58
+ "http.referer" : "http.request.header.referer" ,
59
+ "http.method" : semconv .AttributeHTTPRequestMethod ,
60
+ "http.route" : semconv .AttributeHTTPRoute ,
61
+ "http.version" : semconv .AttributeNetworkProtocolVersion ,
62
+ "http.server_name" : semconv .AttributeServerAddress ,
63
+ "http.url" : semconv .AttributeURLFull ,
64
+ "http.useragent" : semconv .AttributeUserAgentOriginal ,
65
+
53
66
// Other
54
67
"process_id" : semconv .AttributeProcessPID ,
55
68
"error.stacktrace" : semconv .AttributeExceptionStacktrace ,
@@ -80,6 +93,15 @@ func translateDatadogKeyToOTel(k string) string {
80
93
if otelKey , ok := datadogKnownResourceAttributes [strings .ToLower (k )]; ok {
81
94
return otelKey
82
95
}
96
+
97
+ // HTTP dynamic attributes
98
+ if strings .HasPrefix (k , "http.response.headers." ) { // type: string[]
99
+ header := strings .TrimPrefix (k , "http.response.headers." )
100
+ return "http.response.header." + header
101
+ } else if strings .HasPrefix (k , "http.request.headers." ) { // type: string[]
102
+ header := strings .TrimPrefix (k , "http.request.headers." )
103
+ return "http.request.header." + header
104
+ }
83
105
return k
84
106
}
85
107
@@ -136,12 +158,15 @@ func tagsToAttributes(tags []string, host string, stringPool *StringPool) attrib
136
158
for _ , tag := range tags {
137
159
key , val = translateDatadogTagToKeyValuePair (tag )
138
160
if attr , ok := datadogKnownResourceAttributes [key ]; ok {
139
- val = stringPool .Intern (val ) // No need to intern the key if we already have it
140
- if key == semconv .AttributeContainerImageTags {
161
+ val = stringPool .Intern (val ) // No need to intern the key if we already have it
162
+ if key == semconv .AttributeContainerImageTags { // type: string[]
141
163
attrs .resource .PutEmptySlice (attr ).AppendEmpty ().SetStr (val )
142
164
} else {
143
165
attrs .resource .PutStr (attr , val )
144
166
}
167
+ } else if strings .HasPrefix (key , "http.request.header" ) || strings .HasPrefix (key , "http.response.header." ) {
168
+ // type: string[]
169
+ attrs .resource .PutEmptySlice (attr ).AppendEmpty ().SetStr (val )
145
170
} else {
146
171
key = stringPool .Intern (translateDatadogKeyToOTel (key ))
147
172
val = stringPool .Intern (val )
0 commit comments