Commit 5770ca1
authored
[Dynamic Instrumentation] DEBUG-5101 line probe two segment fallback (#8543)
## Summary of changes
- Update `LineProbeResolver` to support line probe source-file fallback
matches when only the last 2 path segments match (down from 4).
- Keep the existing strict-top-score binding rule, so fallback only
binds when a single qualified candidate has the strictly highest
matching-trailing-segment score across all currently loaded symbolicated
assemblies.
- Preserve bound diagnostics for fallback resolutions by reporting
`FallbackTrailingSuffixMatch` together with the matched trailing-segment
count.
- Extend `LineProbeResolverTest` coverage for 2-segment fallback binding
and for picking the highest-scoring candidate when incidental
low-scoring matches exist.
## Reason for change
- `DEBUG-5101` requires line probes to resolve when the configured
source path differs from the PDB path except for the trailing directory
and filename (for example `unknown-prefix/Controllers/HomeController.cs`
against a PDB path ending in `Controllers/HomeController.cs`).
- Raising the matching reach without weakening safety is the goal: the
existing top-score ambiguity check (across assemblies and within each
assembly) is sufficient to keep wrong-assembly binding out, so we don't
need to add a new uniqueness restriction on top of it.
## Implementation details
- Lower `MinTrailingSegmentsForFallbackMatch` from 4 to 2 so resolver
fallback can match scenarios like `unknown-prefix/Controllers/File.cs`
against a loaded symbolicated assembly path ending in
`Controllers/File.cs`.
- Encapsulate the cross-assembly qualified-candidate counter inside
`BestFallbackMatchSelection` (replacing the standalone `ref int
qualifiedFallbackMatchCount` parameter on `TrackClosestPathMatch`) and
expose it as `QualifiedMatchCount` so the diagnostics path keeps the
same information.
- Preserve the binding rule: bind to the candidate with the strictly
highest matching-trailing-segment score, reject when the top score is
tied across assemblies or when the top-scoring assembly is itself
internally ambiguous (`HasAmbiguousBestMatch`).
- Keep diagnostics explicit for successful fallback binds by continuing
to emit `LineProbePathMatchType.FallbackTrailingSuffixMatch` together
with the trailing-segment count used to resolve the probe.
- The resolver change stays in warm-path debugger resolution logic and
only adds integer bookkeeping on top of the existing assembly scan; no
new allocations on this path.
## Test coverage
- Ran:
- `LineProbeResolverTest`
- Added coverage for:
- 2-segment fallback binding
(`FallbackMatchBindsWhenOnlyTwoTrailingSegmentsMatch`)
- binding to the highest-scoring qualified candidate when incidental
lower-scoring matches exist
(`BestFallbackMatchSelectionBindsHighestScoreOverIncidentalLowScoringCandidates`)
- binding when a single qualified candidate is tracked
(`BestFallbackMatchSelectionBindsWhenSingleQualifiedCandidateIsTracked`)1 parent ea167be commit 5770ca1
2 files changed
Lines changed: 61 additions & 8 deletions
File tree
- tracer
- src/Datadog.Trace/Debugger
- test/Datadog.Trace.Debugger.IntegrationTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
123 | | - | |
124 | | - | |
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
| |||
210 | 207 | | |
211 | 208 | | |
212 | 209 | | |
213 | | - | |
214 | 210 | | |
215 | 211 | | |
216 | 212 | | |
| |||
237 | 233 | | |
238 | 234 | | |
239 | 235 | | |
240 | | - | |
241 | 236 | | |
242 | 237 | | |
243 | | - | |
| 238 | + | |
244 | 239 | | |
245 | 240 | | |
246 | 241 | | |
| |||
257 | 252 | | |
258 | 253 | | |
259 | 254 | | |
260 | | - | |
| 255 | + | |
261 | 256 | | |
262 | 257 | | |
263 | 258 | | |
| |||
376 | 371 | | |
377 | 372 | | |
378 | 373 | | |
| 374 | + | |
379 | 375 | | |
380 | 376 | | |
381 | 377 | | |
382 | 378 | | |
383 | 379 | | |
| 380 | + | |
| 381 | + | |
384 | 382 | | |
385 | 383 | | |
386 | 384 | | |
387 | 385 | | |
388 | 386 | | |
389 | 387 | | |
390 | 388 | | |
| 389 | + | |
391 | 390 | | |
392 | 391 | | |
393 | 392 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| |||
262 | 276 | | |
263 | 277 | | |
264 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
265 | 292 | | |
266 | 293 | | |
267 | 294 | | |
| |||
271 | 298 | | |
272 | 299 | | |
273 | 300 | | |
| 301 | + | |
274 | 302 | | |
275 | 303 | | |
276 | 304 | | |
277 | 305 | | |
278 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
279 | 322 | | |
280 | 323 | | |
281 | 324 | | |
| |||
433 | 476 | | |
434 | 477 | | |
435 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
436 | 490 | | |
437 | 491 | | |
438 | 492 | | |
| |||
0 commit comments