Commit 0e11757
Fix Azure Functions span parenting via HttpContext.Items
AsyncLocal context doesn't flow through Azure Functions middleware,
causing worker's azure_functions.invoke span to be incorrectly
parented. Use HttpContext.Items as an explicit bridge to pass the
AspNetCore scope to the Azure Functions middleware.
Changes:
- Store AspNetCore scope in HttpContext.Items after creation
- Add Items property to IFunctionContext duck type interface
- Retrieve scope from HttpContext.Items when creating azure_functions.invoke span
- Only use HttpContext.Items fallback when tracer.InternalActiveScope is null
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 9d50874 commit 0e11757
File tree
3 files changed
+41
-4
lines changed- tracer/src/Datadog.Trace
- ClrProfiler/AutoInstrumentation/Azure/Functions
- Isolated
- PlatformHelpers
3 files changed
+41
-4
lines changedLines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
267 | 298 | | |
268 | 299 | | |
269 | 300 | | |
270 | | - | |
| 301 | + | |
271 | 302 | | |
272 | 303 | | |
273 | 304 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| |||
0 commit comments