Commit 50b56d7
committed
Defer OTEP-4947 endpoint until routing tags land; suppress metadata on unsupported runtimes
Addresses two P2 review points on the OTEP-4947 branch.
Endpoint refresh (#2). HTTP server plugins set 'span.type=web' and
'http.method' when a request arrives and only add 'http.route' /
'resource.name' later, once framework routing has resolved the URL. The
writer used to treat any non-undefined webTags result as a fully formed
answer at build time — 'needsEndpoint' would flip to false immediately —
so the OTEP-4947 record's endpoint attribute got frozen as e.g. 'GET'
with no route, and later route arrival was silently ignored.
Defer writing the endpoint until 'isEndpointFinal(tags)' is true (either
'resource.name' is set, or both 'http.method' and 'http.route' are), and
subscribe onTagsUpdated to the raw 'dd-trace:span:tags:update' channel
(not webTagsCache.resolvedCh) so we also see content changes on
already-cached web-server spans. The shared cache still runs first
(module-load subscribe), so its cached webTags is up to date by the time
our handler queries it. Once the endpoint has been appended, further
tags-update fires are no-ops (we can't overwrite a written entry — OTEP
readers honor the first occurrence).
Process-context metadata gate (#4). On non-Linux or non-ACF runtimes,
otel-thread-ctx.start() returns false but tracer_metadata.js was still
publishing the threadlocal_metadata block in the OTel process context —
advertising a decodable OTEP-4947 stream that no writer was producing
records for. Add the same 'process.platform === linux' and 'isACFActive'
gates to getThreadLocalMetadata that start() applies, so the block is
only advertised when the writer can actually run.
Tests: three new cases for the defer-and-append endpoint path and two
new cases for the platform/ACF gates on getThreadLocalMetadata. 24/24
passing.1 parent defc89b commit 50b56d7
2 files changed
Lines changed: 90 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
42 | 58 | | |
43 | 59 | | |
44 | 60 | | |
| |||
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
103 | 123 | | |
104 | 124 | | |
105 | | - | |
| 125 | + | |
106 | 126 | | |
107 | 127 | | |
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
113 | | - | |
| 133 | + | |
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
| |||
145 | 165 | | |
146 | 166 | | |
147 | 167 | | |
148 | | - | |
149 | | - | |
150 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
151 | 174 | | |
152 | 175 | | |
| 176 | + | |
| 177 | + | |
153 | 178 | | |
154 | 179 | | |
155 | 180 | | |
156 | 181 | | |
157 | | - | |
| 182 | + | |
158 | 183 | | |
159 | 184 | | |
160 | 185 | | |
| |||
194 | 219 | | |
195 | 220 | | |
196 | 221 | | |
197 | | - | |
| 222 | + | |
198 | 223 | | |
199 | 224 | | |
200 | 225 | | |
| |||
210 | 235 | | |
211 | 236 | | |
212 | 237 | | |
213 | | - | |
214 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
215 | 244 | | |
| 245 | + | |
216 | 246 | | |
217 | 247 | | |
218 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
319 | | - | |
| 318 | + | |
| 319 | + | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
330 | 364 | | |
331 | 365 | | |
332 | 366 | | |
333 | | - | |
| 367 | + | |
334 | 368 | | |
335 | 369 | | |
336 | 370 | | |
| |||
365 | 399 | | |
366 | 400 | | |
367 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
368 | 413 | | |
369 | 414 | | |
370 | 415 | | |
| |||
0 commit comments