[Debugger] Avoid evaluating expressionless snapshot probes#8771
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in the Debugger probe processing pipeline by preventing expression evaluation from running for snapshot probes that have no expression payload (e.g., unconditional full snapshots with no when, templates, metrics, span decorations, or capture expressions). This avoids producing a default/empty ExpressionEvaluationResult that was previously treated as an evaluation error.
Changes:
- Gates calls to
Evaluate()behind a newProbeProcessorState.ShouldEvaluateExpressionsflag. - Introduces
ShouldEvaluateExpressionsto differentiate “needs processing/finalization” from “has expressions to evaluate.” - Adds a regression test covering unconditional full snapshot probes with no expression payload to ensure no
evaluationErrorsare emitted.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tracer/src/Datadog.Trace/Debugger/Expressions/ProbeProcessor.cs | Adds ShouldEvaluateExpressions and uses it to prevent unnecessary/incorrect evaluation for expressionless probes. |
| tracer/test/Datadog.Trace.Tests/Debugger/ProbeProcessorTests.cs | Adds a regression test ensuring expressionless full snapshot probes do not produce evaluation errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BenchmarksBenchmark execution time: 2026-06-09 14:48:46 Comparing candidate commit e22d457 in PR branch Found 0 performance improvements and 2 performance regressions! Performance is the same for 70 metrics, 0 unstable metrics, 64 known flaky benchmarks, 62 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8771) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (75ms) : 71, 80
master - mean (74ms) : 71, 76
section Bailout
This PR (8771) - mean (78ms) : 75, 81
master - mean (80ms) : 75, 85
section CallTarget+Inlining+NGEN
This PR (8771) - mean (1,117ms) : 1061, 1173
master - mean (1,116ms) : 1056, 1177
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (114ms) : 108, 120
master - mean (117ms) : 111, 123
section Bailout
This PR (8771) - mean (115ms) : 112, 118
master - mean (117ms) : 112, 121
section CallTarget+Inlining+NGEN
This PR (8771) - mean (795ms) : 772, 819
master - mean (798ms) : 774, 822
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (102ms) : 99, 106
master - mean (104ms) : 97, 111
section Bailout
This PR (8771) - mean (107ms) : 101, 114
master - mean (105ms) : 100, 110
section CallTarget+Inlining+NGEN
This PR (8771) - mean (948ms) : 910, 986
master - mean (954ms) : 925, 983
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (99ms) : 96, 103
master - mean (101ms) : 93, 108
section Bailout
This PR (8771) - mean (101ms) : 97, 105
master - mean (101ms) : 99, 102
section CallTarget+Inlining+NGEN
This PR (8771) - mean (825ms) : 794, 857
master - mean (820ms) : 775, 864
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (200ms) : 194, 205
master - mean (198ms) : 191, 205
section Bailout
This PR (8771) - mean (203ms) : 199, 207
master - mean (202ms) : 197, 207
section CallTarget+Inlining+NGEN
This PR (8771) - mean (1,197ms) : 1154, 1240
master - mean (1,194ms) : 1153, 1235
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (286ms) : 279, 293
master - mean (286ms) : 281, 291
section Bailout
This PR (8771) - mean (288ms) : 282, 294
master - mean (286ms) : 281, 292
section CallTarget+Inlining+NGEN
This PR (8771) - mean (963ms) : 943, 982
master - mean (954ms) : 931, 977
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (278ms) : 270, 285
master - mean (276ms) : 270, 282
section Bailout
This PR (8771) - mean (278ms) : 272, 283
master - mean (275ms) : 269, 280
section CallTarget+Inlining+NGEN
This PR (8771) - mean (1,156ms) : 1112, 1200
master - mean (1,153ms) : 1121, 1185
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8771) - mean (279ms) : 272, 285
master - mean (275ms) : 269, 281
section Bailout
This PR (8771) - mean (279ms) : 273, 284
master - mean (275ms) : 270, 281
section CallTarget+Inlining+NGEN
This PR (8771) - mean (1,038ms) : 998, 1078
master - mean (1,034ms) : 991, 1076
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Summary of changes - Prevents `ProbeProcessor` from invoking expression evaluation for probes that do not have any expression payload. - Adds `ShouldEvaluateExpressions` to distinguish “this capture point should finalize/process” from “this probe has expressions to evaluate.” - Adds regression coverage for unconditional full snapshot probes without `when`, template, metric, span decoration, or capture expressions. ## Reason for change - We discovered this regression while running the snapshot exploration test against Protobuf. - Snapshot exploration generated full snapshot probes with `captureSnapshot: true` and no `when` expression. Those probes reached `Evaluate()`, produced a default `ExpressionEvaluationResult`, and were reported as `Evaluation result should not be null`. - In production, expression evaluation should not run when there is no `when` or other expression payload to evaluate. ## Implementation details - Keeps the existing guard that treats a null/default evaluation result as an error when evaluation was actually required. - Gates calls to `Evaluate()` behind `ProbeProcessorState.ShouldEvaluateExpressions`. - `ShouldEvaluateExpressions` is true for conditions, template segments, metric evaluation/count metrics, span decorations, and capture expressions. ## Test coverage - Ran: - `ProbeProcessorTests`
Summary of changes
ProbeProcessorfrom invoking expression evaluation for probes that do not have any expression payload.ShouldEvaluateExpressionsto distinguish “this capture point should finalize/process” from “this probe has expressions to evaluate.”when, template, metric, span decoration, or capture expressions.Reason for change
captureSnapshot: trueand nowhenexpression. Those probes reachedEvaluate(), produced a defaultExpressionEvaluationResult, and were reported asEvaluation result should not be null.whenor other expression payload to evaluate.Implementation details
Evaluate()behindProbeProcessorState.ShouldEvaluateExpressions.ShouldEvaluateExpressionsis true for conditions, template segments, metric evaluation/count metrics, span decorations, and capture expressions.Test coverage
ProbeProcessorTests