Skip to content

[Debugger] Bound Dynamic Instrumentation probe expression evaluation with a time budget#8806

Open
dudikeleti wants to merge 4 commits into
masterfrom
dudik/di-eval-budget
Open

[Debugger] Bound Dynamic Instrumentation probe expression evaluation with a time budget#8806
dudikeleti wants to merge 4 commits into
masterfrom
dudik/di-eval-budget

Conversation

@dudikeleti

@dudikeleti dudikeleti commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • Adds a cooperative evaluation time budget to Dynamic Instrumentation (DI) probe expressions, so a compiled probe expression can no longer run unbounded in the customer's thread.
  • Introduces EvaluationBudget (a ref-passed value type), CompiledExpressionDelegate<T> (delegate signature now carries ref EvaluationBudget), and EvaluationTimeBudgetExceededException.
  • The parser injects lightweight budget checkpoints into the generated expression tree at the points that can dominate runtime: the expression root, every collection loop, string operations, dumps, and regex.
  • A single budget (one deadline) is created per probe hit and threaded through templates → condition → metric → span decorations → capture expressions.
  • Hand-rolls the enumerable any/all/filter loops (instead of LINQ) so a checkpoint can be placed inside each iteration; uses a real Regex timeout for pattern matching.
  • Removes budget checkpoints from two paths where they add cost without value: the SafeEquals binary path and member/property access (the latter ahead of a separate change restricting member access to fields and auto-properties).

Reason for change

  • DI probe expressions are authored remotely and compiled to delegates that execute in the customer's process, on the customer's thread. A pathological or accidentally expensive expression (large collections, nested filters, complex predicates, catastrophic regex) could add unbounded latency and degrade the host application.
  • There was no upper bound on evaluation time. This change makes evaluation self-limiting: once the deadline is reached the expression aborts cooperatively and surfaces an evaluation error instead of hanging.

Implementation details

The budget (EvaluationBudget)

  • Value type passed by ref everywhere (no allocation, no copies).
  • Create(maxMs) records a deadline as Stopwatch.GetTimestamp() + duration (with an overflow guard so very large values clamp to long.MaxValue).
  • ThrowIfExceeded() is the hot checkpoint and is the only thing injected into the common paths. It is amortized: reading the clock on every operation would be too expensive, so it only samples the clock once every OperationsBeforeTimeCheck (32) checkpoints.
    • Marked [MethodImpl(AggressiveInlining)]; the throw/clock helpers are [NoInlining] to keep the inlined hot path tiny.
    • TimedOut is sticky: once the deadline is hit, all later checkpoints throw immediately.
  • GetRemainingTimeout() converts the remaining budget into a TimeSpan and is handed to Regex.IsMatch(...) — regex is the only primitive that can block for a long time inside a single call, so it gets a real hard timeout; a RegexMatchTimeoutException is converted into the budget exception (and marks the budget timed out).
flowchart TD
    Start["ThrowIfExceeded() — inlined into the hot path"] --> T{TimedOut?}
    T -- "yes (sticky)" --> Throw["ThrowTimedOut() [NoInlining]"]
    T -- no --> Dec["--operationsUntilTimeCheck"]
    Dec --> C{"> 0 ?"}
    C -- "yes (31 of 32 calls)" --> Ret["return — no clock read"]
    C -- "no (every 32nd call)" --> Clock["ThrowIfTimeExceeded() [NoInlining]<br/>reset counter to 32, read Stopwatch"]
    Clock --> D{"now >= deadline?"}
    D -- no --> Ret
    D -- yes --> Mark["MarkTimedOut() + throw EvaluationTimeBudgetExceededException"]
Loading

Threading the budget through compiled expressions

  • CompiledExpressionDelegate<T> adds a trailing ref EvaluationBudget budget parameter; CompiledExpression<T>.BudgetedDelegate is the compiled instance.
  • The parser creates an evaluationBudget ref parameter for the generated lambda and emits EvaluationBudget.ThrowIfExceeded(ref evaluationBudget) (BudgetCheck()) at strategic spots.
  • One budget per probe hit: ProbeExpressionEvaluator.Evaluate creates a single budget and passes the same ref to every sub-expression, then stores it back on the (ref struct) result. EvaluateCaptureExpressions reuses that same budget if present, so the deadline spans the whole probe evaluation rather than resetting per sub-expression.
flowchart TD
    A["Probe hit → Evaluate(scopeMembers)"] --> B["CreateBudget(): deadline = now + 50ms"]
    B --> C["Templates(... , ref budget)"]
    C --> D["Condition(... , ref budget)"]
    D --> E["Metric(... , ref budget)"]
    E --> F["Span decorations(... , ref budget)"]
    F --> G["result.EvaluationBudget = budget"]
    G --> H["Capture expressions reuse the same budget (same deadline)"]
Loading

Where checkpoints are injected (BudgetCheck())

  • Root: once at the top of every compiled expression — guarantees even a trivial expression observes an already-exceeded budget.
  • Collection loops: any / all / filter are now hand-built loops (BuildEnumerableLoop) with a single checkpoint at the top of each iteration; enumerator disposal uses Expression.TryFinally. The bounded capture-filter path threads the budget through FilterEvaluationHelpers.FilterForCapture + FilterPredicate<T>, checking once per item and inside the predicate.
  • String operations that scale with input length: Substring, Contains / StartsWith / EndsWith, IsEmpty (string and collection length).
  • Dumps: collection/dictionary dump loops.
  • Regex: real Regex.IsMatch timeout via GetRemainingTimeout().

Checkpoints intentionally removed

  • SafeEquals: equality only dispatches to an allowlisted set of Equals implementations that are bounded and fast, so a per-comparison checkpoint added overhead with no protective value.
  • Member/property access: removed in anticipation of a separate change that restricts member access to fields and auto-properties (which cannot run arbitrary user code). Removing the wrapping block also eliminated a stray rendering artifact in the expression snapshots, so the affected snapshots revert to their clean pre-budget form (no semantic change to results/errors).

Notes / risks

  • Behavior change: expressions that exceed the budget now throw EvaluationTimeBudgetExceededException, surfaced as an evaluation error. As before, a condition that errors defaults to true.
  • Config: DefaultMaxEvaluationTimeInMilliseconds = 50; the evaluator is currently always constructed with this default (not yet exposed as an environment variable).
  • Trimming: Datadog.Trace.Trimming.xml gains a System.Linq.Expressions.TryExpression entry (auto-generated) because the new enumerable loops use Expression.TryFinally.
  • Hot path: the budget is a ref value type, the checkpoint is aggressively inlined, the clock is sampled only every 32 checkpoints, and throw helpers are non-inlined to keep the steady-state path minimal.

Test coverage

  • DebuggerExpressionLanguageTests was extended and its snapshots regenerated to reflect the new loop structure (the budget plumbing is sanitized out of the rendered form).

@datadog-datadog-prod-us1

This comment has been minimized.

@dudikeleti dudikeleti changed the title Dudik/di eval budget [Debugger] Bound Dynamic Instrumentation probe expression evaluation with a time budget Jun 19, 2026
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8806) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration72.54 ± (72.41 - 72.95) ms72.55 ± (72.41 - 72.89) ms+0.0%✅⬆️
.NET Framework 4.8 - Bailout
duration74.36 ± (74.29 - 74.64) ms76.08 ± (76.07 - 76.48) ms+2.3%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1080.76 ± (1078.88 - 1084.93) ms1077.34 ± (1076.55 - 1082.58) ms-0.3%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.36 ± (22.30 - 22.42) ms22.33 ± (22.28 - 22.38) ms-0.1%
process.time_to_main_ms83.55 ± (83.25 - 83.86) ms83.39 ± (83.12 - 83.66) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.93 - 10.93) MB10.92 ± (10.92 - 10.92) MB-0.1%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.07 ± (22.03 - 22.11) ms21.98 ± (21.95 - 22.00) ms-0.4%
process.time_to_main_ms82.28 ± (82.17 - 82.40) ms82.80 ± (82.62 - 82.97) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.97 ± (10.97 - 10.98) MB10.97 ± (10.97 - 10.97) MB-0.0%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms209.68 ± (208.64 - 210.71) ms208.03 ± (207.21 - 208.85) ms-0.8%
process.time_to_main_ms527.19 ± (525.86 - 528.51) ms528.57 ± (527.31 - 529.83) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.65 ± (48.61 - 48.68) MB48.72 ± (48.69 - 48.76) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.4%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.41 ± (21.35 - 21.46) ms21.03 ± (20.99 - 21.07) ms-1.8%
process.time_to_main_ms73.97 ± (73.69 - 74.26) ms71.39 ± (71.18 - 71.60) ms-3.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.63 ± (10.63 - 10.63) MB10.64 ± (10.64 - 10.64) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.03 ± (20.99 - 21.07) ms20.87 ± (20.86 - 20.89) ms-0.8%
process.time_to_main_ms72.61 ± (72.40 - 72.81) ms71.12 ± (71.05 - 71.19) ms-2.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.73 ± (10.73 - 10.73) MB10.75 ± (10.75 - 10.75) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms369.97 ± (367.73 - 372.21) ms370.88 ± (368.73 - 373.02) ms+0.2%✅⬆️
process.time_to_main_ms537.76 ± (536.50 - 539.02) ms535.22 ± (534.10 - 536.34) ms-0.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.12 ± (50.10 - 50.14) MB50.14 ± (50.11 - 50.16) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.4%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.08 ± (19.05 - 19.10) ms19.07 ± (19.04 - 19.10) ms-0.0%
process.time_to_main_ms69.21 ± (69.10 - 69.33) ms69.27 ± (69.14 - 69.41) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.67 - 7.68) MB7.70 ± (7.69 - 7.71) MB+0.4%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.33 ± (19.29 - 19.37) ms19.30 ± (19.26 - 19.33) ms-0.2%
process.time_to_main_ms73.74 ± (73.52 - 73.96) ms72.78 ± (72.57 - 72.99) ms-1.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.72 - 7.73) MB7.74 ± (7.74 - 7.75) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms299.55 ± (296.83 - 302.27) ms302.05 ± (299.83 - 304.27) ms+0.8%✅⬆️
process.time_to_main_ms485.74 ± (484.76 - 486.72) ms482.98 ± (482.09 - 483.86) ms-0.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.10 ± (37.07 - 37.12) MB37.14 ± (37.11 - 37.17) MB+0.1%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.0%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration201.56 ± (201.40 - 202.29) ms202.75 ± (202.33 - 203.27) ms+0.6%✅⬆️
.NET Framework 4.8 - Bailout
duration205.38 ± (205.03 - 205.75) ms206.78 ± (206.27 - 207.00) ms+0.7%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1203.77 ± (1202.85 - 1208.99) ms1206.77 ± (1203.90 - 1209.35) ms+0.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms195.87 ± (195.44 - 196.31) ms195.08 ± (194.64 - 195.51) ms-0.4%
process.time_to_main_ms85.01 ± (84.73 - 85.28) ms84.43 ± (84.06 - 84.79) ms-0.7%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.06 ± (16.03 - 16.09) MB16.08 ± (16.06 - 16.11) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.3%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms195.63 ± (195.29 - 195.97) ms194.88 ± (194.52 - 195.24) ms-0.4%
process.time_to_main_ms86.60 ± (86.40 - 86.81) ms86.25 ± (86.03 - 86.47) ms-0.4%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.12 ± (16.09 - 16.14) MB16.13 ± (16.11 - 16.16) MB+0.1%✅⬆️
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (21 - 21)+0.2%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms387.81 ± (386.36 - 389.25) ms389.84 ± (388.48 - 391.20) ms+0.5%✅⬆️
process.time_to_main_ms540.34 ± (539.04 - 541.64) ms544.43 ± (543.02 - 545.84) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.90 ± (57.70 - 58.11) MB58.50 ± (58.26 - 58.75) MB+1.0%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.2%
.NET 6 - Baseline
process.internal_duration_ms200.23 ± (199.75 - 200.71) ms199.69 ± (199.25 - 200.12) ms-0.3%
process.time_to_main_ms73.54 ± (73.29 - 73.79) ms73.76 ± (73.46 - 74.06) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.38 ± (16.36 - 16.40) MB16.36 ± (16.33 - 16.39) MB-0.1%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.2%
.NET 6 - Bailout
process.internal_duration_ms199.64 ± (199.13 - 200.14) ms199.72 ± (199.30 - 200.14) ms+0.0%✅⬆️
process.time_to_main_ms74.54 ± (74.28 - 74.79) ms74.98 ± (74.76 - 75.19) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.43 ± (16.41 - 16.45) MB16.49 ± (16.46 - 16.51) MB+0.3%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.1%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms589.29 ± (586.87 - 591.70) ms583.35 ± (580.82 - 585.88) ms-1.0%
process.time_to_main_ms553.80 ± (552.63 - 554.96) ms553.35 ± (552.39 - 554.31) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.71 ± (61.61 - 61.81) MB61.42 ± (61.34 - 61.50) MB-0.5%
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.3%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms197.65 ± (197.25 - 198.05) ms196.83 ± (196.42 - 197.25) ms-0.4%
process.time_to_main_ms72.67 ± (72.35 - 72.98) ms72.95 ± (72.64 - 73.25) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.68 ± (11.66 - 11.71) MB11.77 ± (11.75 - 11.80) MB+0.8%✅⬆️
runtime.dotnet.threads.count19 ± (18 - 19)18 ± (18 - 18)-1.5%
.NET 8 - Bailout
process.internal_duration_ms197.13 ± (196.74 - 197.51) ms197.50 ± (197.00 - 198.00) ms+0.2%✅⬆️
process.time_to_main_ms73.67 ± (73.49 - 73.85) ms74.27 ± (74.04 - 74.50) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.73 - 11.77) MB11.79 ± (11.78 - 11.81) MB+0.4%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.2%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms511.96 ± (509.19 - 514.73) ms518.32 ± (515.32 - 521.33) ms+1.2%✅⬆️
process.time_to_main_ms499.36 ± (498.48 - 500.24) ms506.29 ± (505.44 - 507.14) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.92 ± (50.87 - 50.96) MB51.03 ± (50.99 - 51.08) MB+0.2%✅⬆️
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (30 - 30)+0.7%✅⬆️
Comparison explanation

Execution-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:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8806) - mean (73ms)  : 69, 76
    master - mean (73ms)  : 69, 77

    section Bailout
    This PR (8806) - mean (76ms)  : 73, 79
    master - mean (74ms)  : 73, 76

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (1,080ms)  : 1035, 1124
    master - mean (1,082ms)  : 1038, 1126

Loading
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 (8806) - mean (113ms)  : 108, 119
    master - mean (114ms)  : 106, 121

    section Bailout
    This PR (8806) - mean (112ms)  : 107, 116
    master - mean (111ms)  : 109, 113

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (774ms)  : 753, 794
    master - mean (773ms)  : 755, 791

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8806) - mean (99ms)  : 94, 104
    master - mean (102ms)  : 96, 108

    section Bailout
    This PR (8806) - mean (98ms)  : 97, 99
    master - mean (100ms)  : 95, 105

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (937ms)  : 895, 980
    master - mean (937ms)  : 891, 984

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8806) - mean (95ms)  : 92, 98
    master - mean (95ms)  : 92, 98

    section Bailout
    This PR (8806) - mean (99ms)  : 95, 104
    master - mean (101ms)  : 96, 106

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (814ms)  : 772, 856
    master - mean (815ms)  : 772, 857

Loading
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 (8806) - mean (203ms)  : 198, 207
    master - mean (202ms)  : 197, 206

    section Bailout
    This PR (8806) - mean (207ms)  : 203, 210
    master - mean (205ms)  : 202, 209

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (1,207ms)  : 1169, 1245
    master - mean (1,206ms)  : 1165, 1247

Loading
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 (8806) - mean (289ms)  : 282, 297
    master - mean (291ms)  : 285, 297

    section Bailout
    This PR (8806) - mean (291ms)  : 286, 296
    master - mean (292ms)  : 288, 296

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (973ms)  : 951, 994
    master - mean (969ms)  : 949, 989

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8806) - mean (283ms)  : 276, 290
    master - mean (284ms)  : 275, 292

    section Bailout
    This PR (8806) - mean (284ms)  : 279, 289
    master - mean (284ms)  : 278, 290

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (1,174ms)  : 1119, 1229
    master - mean (1,177ms)  : 1140, 1214

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8806) - mean (280ms)  : 274, 286
    master - mean (280ms)  : 275, 285

    section Bailout
    This PR (8806) - mean (282ms)  : 274, 290
    master - mean (281ms)  : 277, 285

    section CallTarget+Inlining+NGEN
    This PR (8806) - mean (1,056ms)  : 1001, 1111
    master - mean (1,041ms)  : 994, 1088

Loading

@pr-commenter

pr-commenter Bot commented Jun 19, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-24 00:28:23

Comparing candidate commit 171cef4 in PR branch dudik/di-eval-budget with baseline commit fd8f42e in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 58 known flaky benchmarks, 68 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0

  • 🟥 throughput [-21645.556op/s; -18231.410op/s] or [-7.296%; -6.145%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1

  • unstable execution_time [-31.248ms; -8.564ms] or [-15.596%; -4.274%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-6842.964op/s; -5861.684op/s] or [-8.114%; -6.950%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-6756.791op/s; -5311.013op/s] or [-6.870%; -5.400%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+298.033ms; +299.497ms] or [+147.895%; +148.621%]
  • 🟥 throughput [-45.872op/s; -42.306op/s] or [-8.253%; -7.612%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+382.199ms; +384.416ms] or [+301.961%; +303.712%]
  • 🟩 throughput [+86.989op/s; +90.711op/s] or [+11.469%; +11.960%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+391.706ms; +395.062ms] or [+346.645%; +349.615%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.528%; +27.540%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.976%; +9.987%]
  • 🟩 execution_time [-15.309ms; -11.025ms] or [-7.150%; -5.149%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.500%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.743%; +105.758%]
  • 🟥 throughput [-274906.726op/s; -269850.492op/s] or [-28.069%; -27.553%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-26.289ms; -21.415ms] or [-11.724%; -9.550%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-149572.516op/s; -133681.979op/s] or [-21.491%; -19.208%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+8960.944op/s; +11845.504op/s] or [+5.702%; +7.537%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+8887.186op/s; +11642.060op/s] or [+7.080%; +9.274%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+457395.870op/s; +475581.978op/s] or [+15.252%; +15.858%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.805ms; -14.474ms] or [-8.668%; -6.672%]
  • 🟩 throughput [+184877.416op/s; +238833.549op/s] or [+7.338%; +9.480%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+299.308ms; +300.213ms] or [+149.554%; +150.006%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+299.194ms; +302.387ms] or [+150.884%; +152.494%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+299.900ms; +302.308ms] or [+151.067%; +152.279%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+296.962ms; +297.976ms] or [+145.856%; +146.354%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+294.504ms; +297.043ms] or [+143.972%; +145.213%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+301.788ms; +304.219ms] or [+150.834%; +152.048%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+23.177µs; +46.976µs] or [+7.399%; +14.997%]
  • 🟥 throughput [-436.002op/s; -235.817op/s] or [-13.591%; -7.351%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+298.384ms; +299.353ms] or [+148.924%; +149.408%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+412.290ms; +420.082ms] or [+447.970%; +456.436%]
  • 🟩 throughput [+781.075op/s; +1024.617op/s] or [+6.418%; +8.419%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • 🟥 execution_time [+366.144ms; +370.115ms] or [+278.010%; +281.025%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+2.824KB; +2.829KB] or [+5.017%; +5.027%]
  • unstable execution_time [+304.134ms; +353.876ms] or [+139.838%; +162.709%]
  • 🟥 throughput [-536.472op/s; -494.115op/s] or [-48.610%; -44.772%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+203.088ms; +336.366ms] or [+86.547%; +143.345%]
  • 🟥 throughput [-671.800op/s; -588.265op/s] or [-44.809%; -39.237%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+343.344ms; +352.466ms] or [+205.359%; +210.815%]
  • 🟥 throughput [-404.639op/s; -366.478op/s] or [-28.174%; -25.517%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.678ms; +304.952ms] or [+152.423%; +153.568%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+300.766ms; +302.420ms] or [+150.714%; +151.543%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+302.209ms; +305.680ms] or [+151.817%; +153.561%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+301.599ms; +304.068ms] or [+151.453%; +152.693%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+297.503ms; +299.686ms] or [+147.102%; +148.181%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+303.555ms; +307.228ms] or [+153.855%; +155.717%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+299.616ms; +301.638ms] or [+150.380%; +151.395%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+302.094ms; +305.025ms] or [+150.566%; +152.027%]
  • 🟩 throughput [+46608.265op/s; +52450.008op/s] or [+9.255%; +10.415%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+299.677ms; +303.953ms] or [+149.087%; +151.214%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+9.533µs; +51.889µs] or [+2.355%; +12.817%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-20.961KB; -20.938KB] or [-7.646%; -7.638%]
  • unstable execution_time [-44.081µs; +11.892µs] or [-8.712%; +2.350%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • unstable execution_time [-40.100µs; +21.219µs] or [-6.949%; +3.677%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • unstable execution_time [+7.473µs; +13.145µs] or [+17.665%; +31.071%]
  • 🟥 throughput [-5437.360op/s; -3470.770op/s] or [-22.890%; -14.611%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-15.712µs; -8.182µs] or [-24.377%; -12.694%]
  • 🟩 throughput [+2169.901op/s; +3772.813op/s] or [+13.313%; +23.147%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.321ms; +302.580ms] or [+152.304%; +152.941%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+304.242ms; +306.414ms] or [+154.858%; +155.964%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+299.738ms; +302.222ms] or [+150.056%; +151.299%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+298.982ms; +301.070ms] or [+149.016%; +150.056%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+300.691ms; +302.389ms] or [+150.993%; +151.845%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+304.537ms; +307.128ms] or [+154.441%; +155.755%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+301.793ms; +302.884ms] or [+150.536%; +151.080%]
  • 🟩 throughput [+60978633.833op/s; +61329426.555op/s] or [+44.408%; +44.664%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+340.947ms; +398.574ms] or [+424.028%; +495.698%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.060ms; +300.150ms] or [+149.164%; +149.708%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+60156.646op/s; +79158.822op/s] or [+6.963%; +9.162%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+75441.088op/s; +85736.677op/s] or [+7.493%; +8.515%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+32143.388op/s; +38710.708op/s] or [+5.837%; +7.029%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+23964.322op/s; +33624.091op/s] or [+5.364%; +7.526%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+95253.262op/s; +113212.584op/s] or [+10.642%; +12.649%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@dudikeleti dudikeleti marked this pull request as ready for review June 22, 2026 14:08
@dudikeleti dudikeleti requested review from a team as code owners June 22, 2026 14:08
@dudikeleti dudikeleti requested a review from Copilot June 22, 2026 14:19
@dudikeleti

Copy link
Copy Markdown
Contributor Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a cooperative evaluation time budget to Dynamic Instrumentation (DI) probe expression execution so remotely-authored expressions can’t run unbounded on customer threads, and threads that budget through all compiled sub-expressions for a probe hit (templates/condition/metric/span decorations/captures).

Changes:

  • Introduces EvaluationBudget, CompiledExpressionDelegate<T> (now budget-aware), and EvaluationTimeBudgetExceededException, and plumbs a single budget through the evaluator.
  • Injects budget checkpoints into generated expression trees (root, loops, string ops, dumps, regex) and replaces LINQ predicate loops with hand-built enumerator loops to checkpoint per-iteration.
  • Updates debugger expression language tests and approval snapshots to reflect the new expression tree shapes and budget plumbing.

Reviewed changes

Copilot reviewed 61 out of 61 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tracer/src/Datadog.Trace/Debugger/DebuggerSettings.cs Adds default max evaluation time constant (50ms).
tracer/src/Datadog.Trace/Debugger/Expressions/CompiledExpression.cs Updates compiled expression container to hold budget-aware delegate and nullable metadata.
tracer/src/Datadog.Trace/Debugger/Expressions/CompiledExpressionDelegate.cs Adds delegate type that carries ref EvaluationBudget.
tracer/src/Datadog.Trace/Debugger/Expressions/EvaluationBudget.cs Implements cooperative deadline + amortized checkpointing.
tracer/src/Datadog.Trace/Debugger/Expressions/EvaluationTimeBudgetExceededException.cs Adds exception used when the evaluation budget is exceeded.
tracer/src/Datadog.Trace/Debugger/Expressions/ExpressionEvaluationResult.cs Stores/reuses a budget across evaluation and capture expression phases.
tracer/src/Datadog.Trace/Debugger/Expressions/FilterEvaluationHelpers.cs Threads budget into bounded capture filtering and adds per-item checkpoints.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionEvaluator.cs Creates one budget per probe hit and threads it through all sub-evaluations; normalizes timeout error message.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.cs Adds evaluation budget parameter to generated lambdas and injects root checkpoints.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.Binary.cs Adds checkpoint before string lexicographic comparisons.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.Collection.cs Replaces LINQ Any/All/Filter with explicit enumerator loops and adds per-iteration checkpoints; budgets bounded capture filter predicate.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.Dump.cs Adds checkpoints inside dump loops and adjusts dump formatting/null handling paths.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.General.cs Uses StringUtil.IsNullOrEmpty for consistency and compatibility.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.String.cs Adds budget-aware regex matching with real regex timeout + checkpoints for string operations.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParserHelper.cs Extends parsed expression parameter bundle to include evaluation budget parameter expression.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionsBucket.cs Improves nullability annotations for TryGetFirstEntry out parameter.
tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml Adds TryExpression preservation for trimming due to Expression.TryFinally usage.
tracer/test/Datadog.Trace.Tests/Debugger/DebuggerExpressionLanguageTests.cs Updates tests to use budgeted delegates and adds budget/timeout behavior tests; updates readable-expression sanitization.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.AccessNullObject.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.AccessNullableStruct.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.AccessNullableStructNotNull.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.AllGt.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ArrayAtIndex.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ChildPrivateMember.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ChildStaticPublicMember.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.Collection.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.CollectionCount.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.CollectionIndex.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.CollectionIndexOutOfRange.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.CustomArrayAtIndex.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.DictionaryKey.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.DictionaryKeyNotExist.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.Duration.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.Exception.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.Filter.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.GreaterThanString.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.GreaterthanOrEqualString.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.HashAnyKeyValueAnd.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.HashFilterKeyValue.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.HasAll.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.HasAny.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.HasAnyCustomObject.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.HasAnyGt.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IllegalCollectionOperation.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IllegalStringOperation.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IsEmpty.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IsEmptyCollection.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.LenAndCountOrHasAny.verified.txt Updates approved snapshot output for new explicit loop shape.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.LessThanString.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.NestedFieldAccess.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.NotEqual.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ParentPrivateMember.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ParentStaticProtectedMember.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.RefGetMember.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.RefGetMemberTwoLevels.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ReturnString.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.This.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.ToStringNotSupported.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.TypeofCustomType.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.TypeofString.verified.txt Updates approved snapshot output for rendering/sanitization changes.
tracer/missing-nullability-files.csv Removes files that are now nullability-enabled from the tracking list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 1246ce2336

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dudikeleti dudikeleti force-pushed the dudik/di-eval-budget branch from 1246ce2 to d58479c Compare June 22, 2026 15:21
@dudikeleti dudikeleti requested a review from jpbempel June 23, 2026 10:02
public const string DebuggerMetricPrefix = "dynamic.instrumentation.metric.probe";
public const int DefaultMaxDepthToSerialize = 3;
public const int DefaultMaxSerializationTimeInMilliseconds = 200;
public const int DefaultMaxEvaluationTimeInMilliseconds = 50;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not publishing an env var to change it?
In Java, I am concern about releasing a hard coded value that is not correct (for whatever reason) and we are no way for the user to modify it!

Moreover, If I am reading correctly, this is wall time budget, right?
means a compacting Gen2 may provoke a timeout of evals (maybe other kind of collection) for whatever reasons.
for eval time I more inclined to use CPU Time when possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not publishing an env var to change it?

I agree that it’s better to make it configurable. I initially added it and then removed it because I had some concerns, I've added the env var 171cef4

Moreover, If I am reading correctly, this is wall time budget, right?
means a compacting Gen2 may provoke a timeout of evals

I see your point, but I still prefer this approach with the known limitation. It's much simpler. Also regexes supports wall-clock timeouts out of the box, and enumerables with custom enumerators may not behave well when using CPU time-based limits.

@dudikeleti dudikeleti force-pushed the dudik/di-eval-budget branch from db7fb26 to 171cef4 Compare June 23, 2026 23:37
@dudikeleti dudikeleti requested a review from a team as a code owner June 23, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants