Commit d608888
committed
Extract shared web-tags cache used by wall profiler and OTEP-4947 writer
The wall profiler and the OTEP-4947 thread-context writer were both
walking each span's started-spans chain to find the nearest web-server
ancestor, each caching the answer under its own Symbol. Move the walk
and cache into packages/dd-trace/src/web-tags-cache.js.
- getCachedWebTags(span): lazy parent-chain walk, cached on a shared
Symbol.
- onSpanTagsUpdated(span): call from a tagsUpdate subscriber; if the
walk previously came up empty and the span is now a web-server span,
promote its tags into the cache. Returns true iff the cache
transitioned from undefined to a real value — a signal to consumers
that they should snapshot the new value into whatever they built
while the answer was undefined.
wall.js still snapshots webTags into its per-sample ProfilingContext
because label generation reads it from the sample-context ref (not from
the span); its tagsUpdate handler now refreshes that snapshot only when
the shared cache signals a transition.
otel-thread-ctx.js's cached-per-span record drops the local walk plus
the webTags / webTagsResolved fields; it now just tracks whether the
ThreadContext was built without an endpoint (needsEndpoint) and appends
one when the shared cache reports a late transition.
No functional change. CODEOWNERS gets the new file scoped to
@DataDog/profiling-js (same as its two callers).1 parent 463f561 commit d608888
5 files changed
Lines changed: 164 additions & 114 deletions
File tree
- .github
- packages/dd-trace
- src
- profiling/profilers
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 91 | | |
129 | | - | |
130 | | - | |
| 92 | + | |
| 93 | + | |
131 | 94 | | |
132 | 95 | | |
133 | 96 | | |
| |||
136 | 99 | | |
137 | 100 | | |
138 | 101 | | |
139 | | - | |
| 102 | + | |
140 | 103 | | |
141 | 104 | | |
142 | 105 | | |
143 | 106 | | |
144 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
145 | 112 | | |
| 113 | + | |
146 | 114 | | |
147 | 115 | | |
148 | 116 | | |
| |||
177 | 145 | | |
178 | 146 | | |
179 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
180 | 151 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
198 | 160 | | |
199 | 161 | | |
200 | 162 | | |
| |||
232 | 194 | | |
233 | 195 | | |
234 | 196 | | |
235 | | - | |
| 197 | + | |
236 | 198 | | |
237 | 199 | | |
238 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| |||
245 | 248 | | |
246 | 249 | | |
247 | 250 | | |
248 | | - | |
249 | 251 | | |
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
| 255 | + | |
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
274 | 265 | | |
275 | 266 | | |
276 | 267 | | |
| |||
291 | 282 | | |
292 | 283 | | |
293 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
294 | 289 | | |
295 | 290 | | |
296 | 291 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 292 | + | |
| 293 | + | |
302 | 294 | | |
303 | 295 | | |
304 | 296 | | |
| |||
347 | 339 | | |
348 | 340 | | |
349 | 341 | | |
350 | | - | |
| 342 | + | |
351 | 343 | | |
352 | 344 | | |
353 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments