Skip to content

[Debugger] Resolve instanceof types at runtime#8785

Merged
dudikeleti merged 15 commits into
masterfrom
dudik/el-instanceof-runtime-resolver
Jun 17, 2026
Merged

[Debugger] Resolve instanceof types at runtime#8785
dudikeleti merged 15 commits into
masterfrom
dudik/el-instanceof-runtime-resolver

Conversation

@dudikeleti

@dudikeleti dudikeleti commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • Changes debugger expression instanceof evaluation to resolve target types at runtime instead of parse/compile time.
  • Adds InstanceOfHelper to resolve known framework types and customer types without intentionally loading additional customer assemblies.
  • Adds no-scan fast paths for known BCL/core runtime types such as int, string, Guid, DateTime, TimeSpan, Type, Exception, Array, and related System.* names.
  • Resolves scanned customer type names with exact, case-sensitive matching, and requires fully qualified type names unless the target is a known BCL/core alias.
  • Caches customer type resolution with immutable entries, weak references for resolved customer types, scanned assembly identities, and atomic assembly-load generation tracking.
  • Updates expression snapshots and adds regression coverage for condition, template, capture expression, span decoration, lazy assembly loading, ambiguity, cache behavior, generic argument resolution, no-load behavior, exact matching, and bounded retry behavior.

Reason for change

  • instanceof previously resolved target types too early, which meant expressions could fail when customer types were loaded after probe parsing.
  • Dynamic instrumentation expressions need to work against customer application types that may only become available later in process lifetime.
  • Runtime type resolution must avoid loading assemblies as a side effect in instrumented customer processes.
  • Customer type lookup should be deterministic: ambiguous names fail with a controlled expression error, and callers can use assembly-qualified names to disambiguate.

Implementation details

  • instanceof now compiles to a runtime helper call: InstanceOfHelper.IsInstanceOf<TValue>(value, typeName).
  • Known BCL/core aliases are resolved before cache lookup, generation checks, or loaded assembly scans. These names do not depend on loaded customer assemblies.
  • Known framework assembly-qualified names are resolved through framework fast paths where possible, preserving the no-scan behavior for BCL/framework types.
  • Customer type names are resolved lazily from AppDomain.CurrentDomain.GetAssemblies() only when an expression is evaluated.
  • Namespace-qualified customer type names are treated as best effort:
    • If no matching loaded type is found, the miss is cached for the observed assembly-load generation and retried after new assemblies load.
    • If one matching loaded type is found, that result is cached and kept stable while the weak Type reference remains alive.
    • If multiple different matching loaded types are found, evaluation fails with a controlled expression error.
  • For simple scanned type names, the resolver uses exact case-sensitive Assembly.GetType; there is no case-insensitive fallback for customer types.
  • For constructed generic names that contain assembly-qualified generic arguments, the resolver uses callback-based Type.GetType resolution where assembly callbacks return only known framework assemblies or already-loaded assemblies. Missing generic argument assemblies stay unresolved instead of being loaded.
  • Generic argument assembly resolution requires exact full identity matches when metadata is supplied. Simple-name fallback is only used for simple-name assembly requests.
  • Assembly-qualified names are parsed and supported by the resolver, but this PR does not make them the required customer-facing format.
  • Scanned assembly identities are cached using assembly full name plus runtime identity, without holding Assembly references.
  • Resolved customer Type values are cached through WeakReference<Type> so the cache does not keep collectible AssemblyLoadContexts alive. If a weak type target is collected, that cache entry is discarded and the next lookup resolves from the currently loaded assemblies again.
  • Debug logging was added for suspicious best-effort mismatches where a namespace-qualified lookup resolves to one type but the runtime value has the same full name from another assembly.

Test coverage

  • Added/updated DebuggerExpressionLanguageTests coverage for runtime instanceof resolution across conditions, templates, capture expressions, span decorations, known BCL/framework names, customer names, assembly-qualified names, generic arguments, ambiguity, cache behavior, lazy assembly loading, no-load behavior, exact matching, and bounded retry behavior.
  • Updated Verify snapshots for instanceof expression output and unknown-type error behavior.

Other details

@datadog-prod-us1-6

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented Jun 12, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-17 14:40:09

Comparing candidate commit 373fbb1 in PR branch dudik/el-instanceof-runtime-resolver with baseline commit 2d3de8b in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 64 known flaky benchmarks, 62 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 ----------------------------------'

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 throughput [-6141.632op/s; -5714.446op/s] or [-7.011%; -6.523%]

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.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-8184.478op/s; -7656.738op/s] or [-9.704%; -9.079%]

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

  • 🟥 throughput [-7326.980op/s; -6036.304op/s] or [-7.450%; -6.138%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+297.179ms; +299.186ms] or [+147.470%; +148.467%]
  • 🟥 throughput [-45.396op/s; -41.565op/s] or [-8.168%; -7.478%]

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

  • 🟥 execution_time [+379.955ms; +382.192ms] or [+300.188%; +301.955%]
  • 🟩 throughput [+90.704op/s; +94.454op/s] or [+11.959%; +12.453%]

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

  • 🟥 execution_time [+393.324ms; +395.920ms] or [+348.077%; +350.375%]

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.628ms; -11.419ms] or [-7.299%; -5.333%]

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 [-285124.733op/s; -280808.109op/s] or [-29.113%; -28.672%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-25.472ms; -20.555ms] or [-11.359%; -9.167%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-160400.317op/s; -143982.404op/s] or [-23.046%; -20.687%]

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

  • 🟩 throughput [+8237.629op/s; +11344.528op/s] or [+5.241%; +7.218%]

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

  • 🟩 throughput [+8721.633op/s; +11355.179op/s] or [+6.948%; +9.046%]

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

  • 🟩 throughput [+490516.742op/s; +506484.620op/s] or [+16.356%; +16.888%]

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

  • 🟩 execution_time [-19.171ms; -14.799ms] or [-8.837%; -6.822%]
  • 🟩 throughput [+151570.662op/s; +204997.444op/s] or [+6.016%; +8.137%]

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

  • 🟥 execution_time [+300.472ms; +301.210ms] or [+150.135%; +150.504%]

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

  • 🟥 execution_time [+300.017ms; +303.655ms] or [+151.299%; +153.134%]

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

  • 🟥 execution_time [+300.559ms; +303.347ms] or [+151.398%; +152.803%]

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

  • 🟥 execution_time [+296.168ms; +297.385ms] or [+145.466%; +146.064%]

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

  • 🟥 execution_time [+293.607ms; +294.622ms] or [+143.533%; +144.030%]

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

  • 🟥 execution_time [+303.301ms; +305.679ms] or [+151.589%; +152.778%]

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

  • 🟥 execution_time [+23.800µs; +47.453µs] or [+7.598%; +15.149%]
  • 🟥 throughput [-440.469op/s; -241.437op/s] or [-13.731%; -7.526%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.953ms; +300.760ms] or [+149.707%; +150.110%]

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

  • 🟥 execution_time [+419.960ms; +426.110ms] or [+456.304%; +462.986%]
  • 🟩 throughput [+758.464op/s; +940.211op/s] or [+6.232%; +7.726%]

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

  • 🟥 execution_time [+368.798ms; +372.658ms] or [+280.025%; +282.956%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+321.982ms; +399.368ms] or [+148.044%; +183.625%]
  • 🟥 throughput [-623.169op/s; -568.696op/s] or [-56.465%; -51.529%]

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

  • unstable execution_time [+206.416ms; +339.728ms] or [+87.966%; +144.778%]
  • 🟥 throughput [-677.575op/s; -593.528op/s] or [-45.194%; -39.588%]

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

  • 🟥 allocated_mem [+2.305KB; +2.308KB] or [+5.442%; +5.450%]
  • 🟥 execution_time [+346.124ms; +358.612ms] or [+207.022%; +214.491%]
  • 🟥 throughput [-467.955op/s; -432.479op/s] or [-32.583%; -30.113%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • unstable throughput [+12.840op/s; +51.335op/s] or [+3.691%; +14.756%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-189.924µs; -157.173µs] or [-9.621%; -7.962%]
  • 🟩 throughput [+44.783op/s; +53.918op/s] or [+8.841%; +10.644%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.494ms; +305.058ms] or [+152.330%; +153.621%]

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

  • 🟥 execution_time [+301.129ms; +302.405ms] or [+150.896%; +151.536%]

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

  • 🟥 execution_time [+299.889ms; +303.760ms] or [+150.652%; +152.596%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+300.245ms; +302.464ms] or [+150.773%; +151.887%]

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

  • 🟥 execution_time [+300.309ms; +302.840ms] or [+148.489%; +149.741%]

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

  • 🟥 execution_time [+301.100ms; +305.449ms] or [+152.611%; +154.815%]
  • 🟩 throughput [+24190.058op/s; +32848.132op/s] or [+5.224%; +7.093%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.689ms; +305.120ms] or [+151.420%; +153.143%]

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

  • 🟥 execution_time [+298.749ms; +301.174ms] or [+148.899%; +150.108%]
  • 🟩 throughput [+49597.372op/s; +55792.106op/s] or [+9.848%; +11.079%]

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

  • 🟥 execution_time [+301.962ms; +304.785ms] or [+150.223%; +151.628%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472

  • 🟥 throughput [-15890.781op/s; -14175.625op/s] or [-6.390%; -5.700%]

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

  • 🟩 execution_time [-16.534ms; -12.881ms] or [-7.688%; -5.990%]
  • 🟩 throughput [+19982.664op/s; +26812.857op/s] or [+5.482%; +7.356%]

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

  • unstable execution_time [+9.124µs; +51.683µs] or [+2.254%; +12.766%]

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

  • 🟩 allocated_mem [-18.675KB; -18.654KB] or [-6.812%; -6.804%]
  • unstable execution_time [+20.113µs; +140.290µs] or [+3.975%; +27.728%]
  • unstable throughput [-299.200op/s; -0.696op/s] or [-14.930%; -0.035%]

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

  • 🟩 allocated_mem [-23.072KB; -23.053KB] or [-8.411%; -8.404%]
  • unstable execution_time [+75.618µs; +285.401µs] or [+13.104%; +49.458%]
  • unstable throughput [-361.259op/s; -73.165op/s] or [-20.639%; -4.180%]

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

  • unstable execution_time [+8.867µs; +13.967µs] or [+20.959%; +33.015%]
  • 🟥 throughput [-5880.289op/s; -3888.138op/s] or [-24.754%; -16.368%]

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

  • unstable execution_time [-12.981µs; -5.453µs] or [-20.140%; -8.460%]
  • 🟩 throughput [+1214.855op/s; +2834.493op/s] or [+7.454%; +17.391%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.959ms; +303.411ms] or [+152.627%; +153.361%]

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

  • 🟥 execution_time [+303.555ms; +305.964ms] or [+154.509%; +155.735%]

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

  • 🟥 execution_time [+300.343ms; +302.575ms] or [+150.359%; +151.476%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 throughput [-21213.811op/s; -19794.083op/s] or [-5.873%; -5.480%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+30887.470op/s; +33479.206op/s] or [+5.846%; +6.337%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.397ms; +303.483ms] or [+150.219%; +151.259%]

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

  • 🟥 execution_time [+300.908ms; +303.141ms] or [+151.101%; +152.223%]

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

  • 🟥 execution_time [+304.135ms; +306.727ms] or [+154.238%; +155.552%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.299ms; +301.219ms] or [+149.791%; +150.250%]
  • 🟩 throughput [+61293745.743op/s; +61681400.144op/s] or [+44.638%; +44.920%]

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

  • 🟥 execution_time [+418.255ms; +421.190ms] or [+520.175%; +523.824%]

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

  • 🟥 execution_time [+298.813ms; +299.855ms] or [+149.041%; +149.561%]

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

  • 🟩 throughput [+99228.041op/s; +106838.161op/s] or [+9.265%; +9.975%]

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

  • 🟩 throughput [+63706.907op/s; +82862.285op/s] or [+7.374%; +9.591%]

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

  • 🟩 throughput [+94084.923op/s; +124213.786op/s] or [+7.282%; +9.614%]

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

  • 🟩 throughput [+90722.743op/s; +98622.681op/s] or [+9.010%; +9.795%]

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

  • 🟩 throughput [+47456.876op/s; +52251.336op/s] or [+8.617%; +9.488%]

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

  • 🟩 throughput [+29813.806op/s; +39528.892op/s] or [+6.673%; +8.848%]

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

  • 🟩 throughput [+80076.606op/s; +98175.251op/s] or [+8.947%; +10.969%]

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 net6.0
  • 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_GetContext_Sampled netcoreapp3.1
  • 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.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 netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

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 PR changes the debugger expression language instanceof operator to resolve target types at runtime (during evaluation) rather than at parse/compile time, enabling expressions to work even when customer types are loaded later in the process lifetime.

Changes:

  • Compiles instanceof into a runtime helper call (InstanceOfHelper.IsInstanceOf<TValue>(value, typeName)) and adds a resolver that inspects already-loaded assemblies without triggering assembly loads.
  • Adds a fast-path for common BCL/core runtime types (aliases + System.* names) to avoid any assembly scanning.
  • Expands test coverage and updates approval snapshots to reflect the new runtime-resolution behavior (including caching, ambiguity, lazy load, and bounded retry cases).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParser.General.cs Switches instanceof compilation from parse-time Type.GetType to a runtime helper call.
tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParserHelper.cs Fixes reflection-based generic method lookup so internal generic methods (like the new helper) can be found correctly.
tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Adds runtime type resolution + caching logic for instanceof without loading assemblies, including BCL fast-path.
tracer/test/Datadog.Trace.Tests/Debugger/DebuggerExpressionLanguageTests.cs Adds regression tests for runtime resolution, caching, ambiguity, and lazy assembly load behavior.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IsInstanceOfTrue.verified.txt Updates snapshot to reflect helper-based instanceof evaluation.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IsInstanceOfFalse.verified.txt Updates snapshot to reflect helper-based instanceof evaluation.
tracer/test/Datadog.Trace.Tests/Debugger/ProbeExpressionsResources/Approvals/DebuggerExpressionLanguageTests.IsInstanceOfUnknownType.verified.txt Updates snapshot to reflect that string is now treated as a known alias at runtime (no longer an “unknown type” parse-time failure).

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

Comment thread tracer/test/Datadog.Trace.Tests/Debugger/DebuggerExpressionLanguageTests.cs Outdated
@dudikeleti
dudikeleti requested a review from Copilot June 12, 2026 16:44
@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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6dfbabf43

ℹ️ 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".

Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
@dd-trace-dotnet-ci-bot

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

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8785) 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.49 ± (72.52 - 72.81) ms73.98 ± (74.19 - 74.70) ms+2.0%✅⬆️
.NET Framework 4.8 - Bailout
duration76.78 ± (76.59 - 76.94) ms77.25 ± (77.11 - 77.45) ms+0.6%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1092.63 ± (1091.14 - 1097.02) ms1096.29 ± (1096.92 - 1103.26) ms+0.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.35 ± (22.32 - 22.38) ms22.58 ± (22.52 - 22.64) ms+1.0%✅⬆️
process.time_to_main_ms83.38 ± (83.19 - 83.57) ms84.92 ± (84.63 - 85.21) ms+1.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.90 ± (10.90 - 10.90) MB10.91 ± (10.91 - 10.91) MB+0.1%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.49 ± (22.44 - 22.55) ms22.42 ± (22.37 - 22.47) ms-0.3%
process.time_to_main_ms86.26 ± (85.97 - 86.56) ms85.23 ± (85.02 - 85.44) ms-1.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.93 - 10.94) MB10.95 ± (10.95 - 10.95) MB+0.1%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms214.13 ± (213.22 - 215.04) ms215.53 ± (214.56 - 216.50) ms+0.7%✅⬆️
process.time_to_main_ms541.30 ± (540.02 - 542.58) ms544.64 ± (543.22 - 546.07) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.67 ± (48.64 - 48.70) MB48.57 ± (48.53 - 48.61) MB-0.2%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.72 ± (21.65 - 21.79) ms21.28 ± (21.25 - 21.31) ms-2.0%
process.time_to_main_ms75.86 ± (75.55 - 76.16) ms73.27 ± (73.12 - 73.43) ms-3.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.64 ± (10.64 - 10.64) MB10.63 ± (10.63 - 10.63) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.10 ± (21.06 - 21.13) ms21.13 ± (21.09 - 21.17) ms+0.2%✅⬆️
process.time_to_main_ms73.65 ± (73.48 - 73.83) ms73.57 ± (73.40 - 73.74) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.74 ± (10.74 - 10.74) MB10.74 ± (10.74 - 10.75) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms372.53 ± (370.62 - 374.43) ms370.70 ± (368.45 - 372.94) ms-0.5%
process.time_to_main_ms546.35 ± (544.97 - 547.73) ms545.80 ± (544.47 - 547.12) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.12 ± (50.10 - 50.14) MB50.06 ± (50.04 - 50.09) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.44 ± (19.41 - 19.47) ms19.68 ± (19.64 - 19.73) ms+1.2%✅⬆️
process.time_to_main_ms72.19 ± (72.00 - 72.38) ms73.95 ± (73.74 - 74.16) ms+2.4%✅⬆️
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.70) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.67 ± (19.61 - 19.73) ms19.36 ± (19.33 - 19.40) ms-1.6%
process.time_to_main_ms75.51 ± (75.27 - 75.76) ms73.70 ± (73.54 - 73.87) ms-2.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.72 - 7.73) MB7.75 ± (7.74 - 7.76) MB+0.3%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms293.68 ± (291.34 - 296.02) ms299.33 ± (297.07 - 301.59) ms+1.9%✅⬆️
process.time_to_main_ms497.51 ± (496.53 - 498.49) ms493.61 ± (492.54 - 494.67) ms-0.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.18 ± (37.15 - 37.21) MB37.20 ± (37.17 - 37.23) MB+0.1%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.6%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration201.20 ± (200.53 - 201.63) ms199.44 ± (199.37 - 200.33) ms-0.9%
.NET Framework 4.8 - Bailout
duration205.28 ± (204.62 - 205.65) ms204.32 ± (204.16 - 205.06) ms-0.5%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1197.10 ± (1194.03 - 1199.98) ms1199.19 ± (1199.00 - 1204.78) ms+0.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms193.30 ± (192.87 - 193.74) ms192.48 ± (192.10 - 192.87) ms-0.4%
process.time_to_main_ms83.77 ± (83.43 - 84.10) ms83.28 ± (83.00 - 83.57) ms-0.6%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.05 ± (16.03 - 16.07) MB16.03 ± (16.00 - 16.05) MB-0.2%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.2%
.NET Core 3.1 - Bailout
process.internal_duration_ms192.16 ± (191.74 - 192.58) ms192.20 ± (191.79 - 192.62) ms+0.0%✅⬆️
process.time_to_main_ms83.98 ± (83.72 - 84.24) ms84.76 ± (84.55 - 84.98) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.12 ± (16.10 - 16.15) MB16.07 ± (16.05 - 16.09) MB-0.3%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (20 - 21)-0.3%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms386.33 ± (384.64 - 388.01) ms385.80 ± (384.56 - 387.05) ms-0.1%
process.time_to_main_ms537.51 ± (536.18 - 538.84) ms538.80 ± (537.49 - 540.12) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.89 ± (57.68 - 58.10) MB57.58 ± (57.42 - 57.75) MB-0.5%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.5%
.NET 6 - Baseline
process.internal_duration_ms199.87 ± (199.37 - 200.37) ms199.83 ± (199.34 - 200.33) ms-0.0%
process.time_to_main_ms73.34 ± (73.10 - 73.58) ms73.40 ± (73.13 - 73.68) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.39 ± (16.36 - 16.42) MB16.38 ± (16.35 - 16.41) MB-0.1%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.8%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms198.67 ± (198.30 - 199.04) ms198.53 ± (198.03 - 199.04) ms-0.1%
process.time_to_main_ms74.45 ± (74.18 - 74.73) ms74.35 ± (74.09 - 74.61) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.41 ± (16.39 - 16.44) MB16.45 ± (16.43 - 16.48) MB+0.2%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms585.08 ± (582.64 - 587.52) ms583.58 ± (580.84 - 586.32) ms-0.3%
process.time_to_main_ms547.69 ± (546.45 - 548.94) ms546.07 ± (544.75 - 547.39) ms-0.3%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.44 ± (61.35 - 61.53) MB61.43 ± (61.33 - 61.54) MB-0.0%
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.4%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms197.26 ± (196.82 - 197.70) ms195.44 ± (195.05 - 195.84) ms-0.9%
process.time_to_main_ms72.33 ± (72.04 - 72.63) ms71.98 ± (71.71 - 72.26) ms-0.5%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.70 ± (11.69 - 11.72) MB11.76 ± (11.74 - 11.79) MB+0.5%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.1%
.NET 8 - Bailout
process.internal_duration_ms196.99 ± (196.54 - 197.45) ms193.20 ± (192.86 - 193.53) ms-1.9%
process.time_to_main_ms73.79 ± (73.58 - 74.01) ms72.16 ± (71.99 - 72.34) ms-2.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.73 - 11.77) MB11.79 ± (11.77 - 11.81) MB+0.3%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.3%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms507.27 ± (504.71 - 509.83) ms513.52 ± (511.09 - 515.96) ms+1.2%✅⬆️
process.time_to_main_ms498.16 ± (497.16 - 499.16) ms495.11 ± (494.29 - 495.94) ms-0.6%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.88 ± (50.84 - 50.91) MB50.91 ± (50.88 - 50.94) MB+0.1%✅⬆️
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 (8785) - mean (74ms)  : 71, 78
    master - mean (73ms)  : 71, 75

    section Bailout
    This PR (8785) - mean (77ms)  : 76, 79
    master - mean (77ms)  : 75, 79

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (1,100ms)  : 1055, 1145
    master - mean (1,094ms)  : 1050, 1139

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 (8785) - mean (115ms)  : 109, 122
    master - mean (113ms)  : 109, 116

    section Bailout
    This PR (8785) - mean (115ms)  : 112, 118
    master - mean (116ms)  : 110, 122

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (797ms)  : 775, 820
    master - mean (793ms)  : 769, 817

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

    section Bailout
    This PR (8785) - mean (102ms)  : 99, 104
    master - mean (101ms)  : 98, 104

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (948ms)  : 915, 981
    master - mean (949ms)  : 908, 991

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8785) - mean (101ms)  : 97, 106
    master - mean (99ms)  : 96, 103

    section Bailout
    This PR (8785) - mean (101ms)  : 97, 104
    master - mean (103ms)  : 100, 107

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (822ms)  : 783, 860
    master - mean (821ms)  : 785, 858

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 (8785) - mean (200ms)  : 194, 205
    master - mean (201ms)  : 193, 209

    section Bailout
    This PR (8785) - mean (205ms)  : 200, 209
    master - mean (205ms)  : 197, 213

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (1,202ms)  : 1162, 1242
    master - mean (1,197ms)  : 1163, 1231

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 (8785) - mean (285ms)  : 278, 292
    master - mean (287ms)  : 281, 293

    section Bailout
    This PR (8785) - mean (287ms)  : 281, 292
    master - mean (285ms)  : 279, 291

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (964ms)  : 941, 988
    master - mean (964ms)  : 945, 984

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8785) - mean (283ms)  : 275, 290
    master - mean (282ms)  : 274, 289

    section Bailout
    This PR (8785) - mean (282ms)  : 273, 290
    master - mean (282ms)  : 275, 289

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (1,160ms)  : 1131, 1189
    master - mean (1,161ms)  : 1126, 1197

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8785) - mean (278ms)  : 272, 283
    master - mean (281ms)  : 273, 289

    section Bailout
    This PR (8785) - mean (276ms)  : 270, 281
    master - mean (282ms)  : 276, 288

    section CallTarget+Inlining+NGEN
    This PR (8785) - mean (1,039ms)  : 1001, 1078
    master - mean (1,038ms)  : 1007, 1070

Loading

@dudikeleti
dudikeleti requested a review from Copilot June 16, 2026 11:38
@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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParserHelper.cs:90

  • ProbeExpressionParserHelper.Methods intends to cache reflection lookups, but the key type (ReflectionMethodIdentifier) stores Type[] arrays. As a record struct, its generated equality compares those arrays by reference, so most call sites that pass freshly-allocated new[] { ... }/[...] arrays will never hit the cache and will continuously add new entries (unbounded growth + extra reflection work).
    internal readonly record struct ReflectionMethodIdentifier
    {
        internal ReflectionMethodIdentifier(Type type, string methodName, Type[] parameters, Type[] genericArguments)
        {
            Type = type;

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8569d733b5

ℹ️ 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".

Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs
@dudikeleti

dudikeleti commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

For reviewer context, here is the current instanceof runtime resolution flow after the latest resolver/cache changes.

Key details that changed from the earlier version:

  • Customer type lookup is exact/case-sensitive. There is no case-insensitive Assembly.GetType fallback.
  • Cache entries are keyed by the exact requested type-name string and track scanned assemblies by assembly full name plus runtime identity.
  • Generic argument assembly resolution uses known framework assemblies or already-loaded assemblies only; full assembly identities must match exactly when metadata is supplied, and simple-name fallback is only used for simple-name requests.
  • Misses are cached for the observed assembly-load generation and retried after new assemblies load; scans skip assemblies already recorded for non-assembly-qualified generic lookups.
flowchart TD
    A["User writes instanceof expression"] --> B["Probe expression parser"]
    B --> C["Emit runtime helper call"]
    C --> D["InstanceOfHelper.IsInstanceOf"]
    D --> E["ResolveType"]

    E --> F{"Empty or null type name?"}
    F -->|"Yes"| F1["Evaluation error: failed to parse type name"]
    F -->|"No"| G{"Known BCL/core alias or exact known System type?"}
    G -->|"Yes"| G1["Return known Type immediately; no assembly scan"]
    G -->|"No"| H{"Cache hit?"}

    H -->|"Resolved Type alive"| H1["Return cached Type"]
    H -->|"Resolved Type was collected"| H2["Discard stale cache entry"]
    H -->|"Cached miss for current generation"| H3["Evaluation error: unknown type; no new assemblies loaded"]
    H -->|"Ambiguous"| H4["Evaluation error: ambiguous type"]
    H -->|"No usable cache entry"| I["Parse type name"]
    H2 --> I

    I --> J{"Top-level assembly name provided?"}
    J -->|"Yes"| K["AssemblyQualifiedTypeResolver"]
    K --> K1{"Known framework assembly/name?"}
    K1 -->|"Yes"| K2["Resolve through framework path; generic args may use framework or already-loaded exact assemblies"]
    K1 -->|"No"| K3["Require fully qualified type name, then scan loaded matching assemblies"]

    J -->|"No"| L{"Simple System type and no assembly-qualified generic args?"}
    L -->|"Yes"| L1["Type.GetType fast path"]
    L1 -->|"Found"| L2["Weak-cache Type and return"]
    L1 -->|"Not found"| M{"Contains namespace dot?"}
    L -->|"No"| M
    M -->|"No"| M1["Evaluation error: must be fully qualified"]
    M -->|"Yes"| N["Scan currently loaded assemblies"]

    K3 --> O["For each eligible assembly"]
    N --> O
Loading
flowchart TD
    O["For each eligible assembly"] --> O1["Skip assemblies already scanned for this exact lookup when safe"]
    O1 --> O2{"Top-level assembly name requested?"}
    O2 -->|"Yes, and assembly identity does not match"| S["No match in this assembly"]
    O2 -->|"No, or identity matches"| P{"Type name shape"}

    P -->|"Simple type name"| Q["Exact case-sensitive Assembly.GetType"]
    Q -->|"Found"| R1["Candidate Type"]
    Q -->|"Not found"| S

    P -->|"Constructed generic with assembly-qualified args"| T["Type.GetType with resolver callbacks"]
    T --> U["Assembly resolver returns known framework assembly or already-loaded exact assembly"]
    U --> V["Simple-name fallback only for simple-name requests"]
    V --> W["No assembly loading side effects"]
    W -->|"Found"| R1
    W -->|"Not found"| S

    R1 --> X{"Scan result after all eligible assemblies"}
    S --> X
    X -->|"No match"| X1["Cache scanned assemblies and miss for observed generation"]
    X1 --> X2{"Assembly loaded during scan?"}
    X2 -->|"Yes"| X3["Retry bounded scan"]
    X2 -->|"No"| X4["Evaluation error: unknown type"]
    X -->|"One match"| X5["Cache weak Type reference and scanned assembly identities"]
    X5 --> X6["Return Type"]
    X -->|"Multiple different matches"| X7["Cache ambiguous result"]
    X7 --> X8["Evaluation error: ambiguous type"]
Loading
flowchart TD
    A["Resolved Type returned to IsInstanceOf"] --> B{"Value category"}
    B -->|"Reference type or nullable value type"| C["Use Type.IsInstanceOfType"]
    B -->|"Non-nullable value type"| D["Use Type.IsAssignableFrom(typeof(TValue))"]
    C --> E["If false, optionally debug-log suspicious same-full-name assembly mismatch"]
    D --> E
    E --> F["Return bool to expression evaluator"]
Loading

@dudikeleti
dudikeleti marked this pull request as ready for review June 16, 2026 12:34
@dudikeleti
dudikeleti requested a review from a team as a code owner June 16, 2026 12:34
@dudikeleti
dudikeleti requested a review from jpbempel June 16, 2026 12:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5963a2235

ℹ️ 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".

Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/InstanceOfHelper.cs Outdated
@dudikeleti
dudikeleti force-pushed the dudik/el-instanceof-runtime-resolver branch from f5963a2 to 373fbb1 Compare June 17, 2026 13:44
@dudikeleti
dudikeleti force-pushed the dudik/el-instanceof-runtime-resolver branch from 373fbb1 to 97b22a3 Compare June 17, 2026 16:18

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread tracer/src/Datadog.Trace/Debugger/Expressions/ProbeExpressionParserHelper.cs Outdated
@dudikeleti
dudikeleti merged commit db226d5 into master Jun 17, 2026
141 of 142 checks passed
@dudikeleti
dudikeleti deleted the dudik/el-instanceof-runtime-resolver branch June 17, 2026 18:21
@github-actions github-actions Bot added this to the vNext-v3 milestone Jun 17, 2026
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