Commit 550b5a2
fix(otlp): align trace metric attributes and aggregation (#9685)
* fix(otlp): align trace-metrics attributes with the RFC attribute spec
Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration)
attribute gaps found in a cross-tracer audit against SEMCON-1093:
- datadog.process_tags now emits one array-valued resource attribute
(mirroring the legacy v0.6/stats ProcessTags shape) instead of
flattening each tag into its own datadog.<key> attribute.
- datadog.is_trace_root is now emitted per data point, gated the same
way as the other datadog.* attributes.
- span.kind is canonicalized to the OTel Span Metrics Connector's
SPAN_KIND_* uppercase convention instead of being passed through
lowercase.
- status.code is now a required string attribute
(STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing
the previous OTLP-trace-style int enum that was only set on errors.
additional_metric_tags and peer_tags remain unimplemented on this
path; both are flagged with a one-line TODO pointing at the
corresponding gap (or its absence) in the legacy v0.6/stats exporter.
* fix(otlp): always emit service.name on trace-metrics data points
service.name was omitted from OTLP trace-metrics data points whenever
a span's service matched the default/global service, mirroring the
status.code fix earlier in this branch: required attributes must be
unconditional, not skipped as an optimization.
* fix(otlp): coalesce trace metrics by exported attributes
* fix(otlp): finalize trace metrics semantics
* fix(otlp): retain semantic attributes in OTel mode
* fix(otlp): defer trace-root attribute detection
* test(otlp): reserve only datadog attributes
* fix(otlp): omit unknown trace-root attribute
* fix(otlp): always emit trace metric attributes
* fix(otlp): guard span kind mapping
* test(otlp): cover unspecified span kind fallback
* fix(otlp): include service-entry metrics and tracer tags
* fix(otlp): harden tracer tags and service-entry tracking
* fix(otlp): retain services across partial flushes
* fix(otlp): weakly retain cached span services
* perf(otlp): reduce trace metric processing overhead
* perf(otlp): remove service tracking from stats hot path
Native stats without OTLP regressed from a 1.26s to 1.43s benchmark median because service-boundary state was tracked for every span. Removing that tracking restores the master baseline; the behavior will move to an OTLP-gated follow-up.
* chore(otlp): keep span processor out of core changes
* refactor(otlp): rely on initialized resource inputs
* refactor(stats): pass trace-root flag directly
* perf(otlp): reuse span metric attribute key
Serialize base attributes once per aggregation group and append the top-level and status dimensions for each distribution key.
Key-generation microbenchmark, two fresh runs with five-trial medians: 570.6ms to 126.9ms and 569.9ms to 127.3ms.
* perf(otlp): avoid redundant attribute transforms
Build the known top-level and status OTLP values directly instead of copying and re-transforming the base attributes.1 parent 1d1fabf commit 550b5a2
7 files changed
Lines changed: 393 additions & 123 deletions
File tree
- packages/dd-trace
- src
- opentelemetry/metrics
- test
- opentelemetry/metrics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| |||
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
| |||
106 | 122 | | |
107 | 123 | | |
108 | 124 | | |
109 | | - | |
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
| |||
115 | 130 | | |
116 | 131 | | |
117 | 132 | | |
118 | | - | |
119 | | - | |
120 | 133 | | |
121 | 134 | | |
122 | 135 | | |
| |||
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | | - | |
20 | | - | |
| 17 | + | |
21 | 18 | | |
22 | | - | |
| 19 | + | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
Lines changed: 96 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
15 | 29 | | |
16 | 30 | | |
17 | 31 | | |
| |||
41 | 55 | | |
42 | 56 | | |
43 | 57 | | |
44 | | - | |
| 58 | + | |
| 59 | + | |
45 | 60 | | |
46 | 61 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
53 | | - | |
54 | | - | |
55 | 65 | | |
56 | | - | |
| 66 | + | |
57 | 67 | | |
58 | | - | |
59 | | - | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
| 93 | + | |
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
111 | 122 | | |
112 | 123 | | |
113 | 124 | | |
| |||
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
126 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
127 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
128 | 176 | | |
129 | 177 | | |
130 | 178 | | |
| |||
140 | 188 | | |
141 | 189 | | |
142 | 190 | | |
| 191 | + | |
143 | 192 | | |
144 | 193 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
149 | 201 | | |
150 | 202 | | |
151 | | - | |
152 | 203 | | |
153 | 204 | | |
154 | 205 | | |
| |||
159 | 210 | | |
160 | 211 | | |
161 | 212 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
167 | 220 | | |
168 | | - | |
| 221 | + | |
169 | 222 | | |
170 | 223 | | |
171 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
153 | 165 | | |
154 | 166 | | |
155 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
156 | 173 | | |
157 | 174 | | |
158 | 175 | | |
| |||
163 | 180 | | |
164 | 181 | | |
165 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
166 | 193 | | |
167 | 194 | | |
168 | | - | |
| 195 | + | |
169 | 196 | | |
170 | 197 | | |
171 | 198 | | |
| |||
192 | 219 | | |
193 | 220 | | |
194 | 221 | | |
195 | | - | |
| 222 | + | |
196 | 223 | | |
197 | 224 | | |
198 | 225 | | |
| |||
0 commit comments