Skip to content

[CI Visibility] Fix coverage resolver assembly file locks#8666

Merged
tonyredondo merged 5 commits into
masterfrom
feat/coverage-resolver-file-locks
May 21, 2026
Merged

[CI Visibility] Fix coverage resolver assembly file locks#8666
tonyredondo merged 5 commits into
masterfrom
feat/coverage-resolver-file-locks

Conversation

@tonyredondo

@tonyredondo tonyredondo commented May 20, 2026

Copy link
Copy Markdown
Member

Summary of changes

  • Replace the coverage collector's nested custom resolver with an owned resolver that caches and disposes Cecil assemblies.
  • Add per-assembly path read/write locking so dependency reads cannot race with target assembly writes.
  • Read target and resolved dependency assemblies in memory so Cecil does not keep output-folder DLL handles open after the read phase.
  • Prevent Cecil fallback probing from bypassing the locked resolver path for output-folder assemblies.
  • Add focused resolver and locking tests for the issue [BUG]: DataDog.Trace.Coverage.collector > System.IO.IOException when processing DLLs to instrument #8592 failure mode.

Reason for change

When the coverage collector processes test assemblies in parallel, one assembly can resolve a sibling DLL as a dependency while another worker tries to rewrite that same DLL. Cecil can keep those resolved dependency handles open inside the same dotnet process, so the rewrite worker repeatedly fails to open the DLL for read/write access.

Fixes #8592.

Implementation details

  • AssemblyProcessor reads the target assembly into memory under a short per-path read lock, then releases that lock before metadata processing and dependency resolution continue.
  • AssemblyProcessor acquires the per-path write lock only while writing the rewritten target assembly back to disk.
  • CoverageAssemblyResolver reads output-folder dependencies through a per-path read lock, uses InMemory = true, caches owned AssemblyDefinition instances, and disposes them with the resolver.
  • The resolver prefers the target assembly directory, invalidates cached copied tracer assemblies when the copied tracer path changes, and removes search directories before using Cecil's platform fallback so output-folder reads cannot bypass the lock.
  • CoverageCollector keeps bounded IOException retry handling and avoids logging stale IO failures after later success or skip paths.

Test coverage

  • dotnet build tracer/src/Datadog.Trace.Coverage.collector/Datadog.Trace.Coverage.collector.csproj
  • dotnet test tracer/test/Datadog.Trace.Tools.Runner.Tests/Datadog.Trace.Tools.Runner.Tests.csproj -f net10.0 --filter "FullyQualifiedName~CoverageResolverTests"
  • DOTNET_ROOT=/usr/local/share/dotnet/x64 /usr/local/share/dotnet/x64/dotnet test tracer/test/Datadog.Trace.Tools.Runner.Tests/Datadog.Trace.Tools.Runner.Tests.csproj -f net8.0 --filter "FullyQualifiedName~CoverageResolverTests"
  • git diff --check master...HEAD

Other details

The Windows-only exclusive-handle assertions are included in CoverageResolverTests and are skipped on non-Windows platforms.

@pr-commenter

pr-commenter Bot commented May 20, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-21 15:23:15

Comparing candidate commit 05d895c in PR branch feat/coverage-resolver-file-locks with baseline commit ba7828b in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 60 known flaky benchmarks, 66 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 [-7011.576op/s; -6780.053op/s] or [-8.004%; -7.740%]

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 [-6592.205op/s; -6089.736op/s] or [-7.816%; -7.221%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • unstable execution_time [-36.196ms; -5.759ms] or [-18.058%; -2.873%]

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

  • 🟥 throughput [-7100.087op/s; -5392.513op/s] or [-7.219%; -5.483%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+315.226ms; +321.560ms] or [+156.426%; +159.569%]
  • 🟥 throughput [-54.988op/s; -47.110op/s] or [-9.893%; -8.476%]

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

  • 🟥 execution_time [+378.871ms; +381.326ms] or [+299.331%; +301.271%]
  • 🟩 throughput [+98.705op/s; +102.183op/s] or [+13.014%; +13.472%]

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

  • 🟥 execution_time [+392.520ms; +397.641ms] or [+347.365%; +351.897%]

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.848ms; -11.679ms] or [-7.401%; -5.455%]

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 [-261670.407op/s; -256142.961op/s] or [-26.718%; -26.153%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-25.974ms; -21.127ms] or [-11.583%; -9.422%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-166027.350op/s; -149296.901op/s] or [-23.855%; -21.451%]

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

  • 🟩 throughput [+9605.351op/s; +12299.929op/s] or [+7.652%; +9.798%]

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

  • 🟩 throughput [+464496.881op/s; +488344.807op/s] or [+15.488%; +16.284%]

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

  • 🟩 execution_time [-18.118ms; -13.747ms] or [-8.352%; -6.337%]
  • 🟩 throughput [+158836.715op/s; +213167.357op/s] or [+6.305%; +8.461%]

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

  • 🟥 execution_time [+300.477ms; +301.452ms] or [+150.138%; +150.625%]

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

  • 🟥 execution_time [+299.485ms; +302.741ms] or [+151.031%; +152.673%]

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

  • 🟥 execution_time [+299.823ms; +302.669ms] or [+151.028%; +152.461%]

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

  • 🟥 execution_time [+298.958ms; +299.742ms] or [+146.836%; +147.221%]

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

  • 🟥 execution_time [+293.440ms; +296.102ms] or [+143.452%; +144.753%]

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

  • 🟥 execution_time [+301.701ms; +303.843ms] or [+150.790%; +151.861%]

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

  • 🟥 execution_time [+18.800µs; +42.398µs] or [+6.002%; +13.535%]
  • 🟥 throughput [-398.528op/s; -199.914op/s] or [-12.423%; -6.232%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.653ms; +300.403ms] or [+149.557%; +149.932%]

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

  • unstable execution_time [+412.416ms; +423.104ms] or [+448.107%; +459.720%]
  • 🟩 throughput [+1016.657op/s; +1243.108op/s] or [+8.354%; +10.215%]

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

  • unstable execution_time [+204.008ms; +264.877ms] or [+154.901%; +201.119%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+2.820KB; +2.825KB] or [+5.010%; +5.019%]
  • unstable execution_time [+344.264ms; +433.161ms] or [+158.289%; +199.163%]
  • 🟥 throughput [-633.450op/s; -574.821op/s] or [-57.397%; -52.084%]

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

  • unstable execution_time [+140.316ms; +285.658ms] or [+59.797%; +121.735%]
  • 🟥 throughput [-669.497op/s; -586.069op/s] or [-44.656%; -39.091%]

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

  • 🟥 execution_time [+347.294ms; +356.528ms] or [+207.722%; +213.245%]
  • 🟥 throughput [-406.398op/s; -368.968op/s] or [-28.297%; -25.691%]

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

  • 🟩 execution_time [-184.661µs; -125.673µs] or [-9.354%; -6.366%]
  • 🟩 throughput [+37.161op/s; +52.402op/s] or [+7.336%; +10.345%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+303.800ms; +306.152ms] or [+152.988%; +154.172%]

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

  • 🟥 execution_time [+300.811ms; +302.107ms] or [+150.737%; +151.386%]

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

  • 🟥 execution_time [+301.732ms; +304.993ms] or [+151.577%; +153.215%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+300.527ms; +302.291ms] or [+150.915%; +151.801%]

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

  • 🟥 execution_time [+296.020ms; +298.774ms] or [+146.369%; +147.730%]

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

  • 🟥 execution_time [+300.176ms; +304.222ms] or [+152.142%; +154.193%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+302.893ms; +305.006ms] or [+152.025%; +153.085%]

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

  • 🟥 execution_time [+301.532ms; +310.216ms] or [+150.286%; +154.614%]
  • 🟩 throughput [+51782.929op/s; +61988.747op/s] or [+10.282%; +12.309%]

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

  • 🟥 execution_time [+300.798ms; +303.143ms] or [+149.644%; +150.811%]

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

  • 🟩 execution_time [-17.018ms; -13.368ms] or [-7.913%; -6.216%]

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

  • unstable execution_time [+10.744µs; +56.735µs] or [+2.654%; +14.014%]

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

  • 🟩 allocated_mem [-20.357KB; -20.335KB] or [-7.426%; -7.418%]
  • unstable execution_time [-39.512µs; +15.898µs] or [-7.809%; +3.142%]

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

  • unstable execution_time [-70.794µs; -11.051µs] or [-12.268%; -1.915%]

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

  • unstable execution_time [+9.516µs; +15.447µs] or [+22.492%; +36.512%]
  • 🟥 throughput [-6182.809op/s; -4036.218op/s] or [-26.028%; -16.991%]

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

  • unstable execution_time [-12.904µs; -4.838µs] or [-20.020%; -7.506%]
  • unstable throughput [+1144.065op/s; +2902.841op/s] or [+7.019%; +17.810%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.615ms; +303.844ms] or [+152.958%; +153.579%]

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

  • 🟥 execution_time [+302.258ms; +305.026ms] or [+153.848%; +155.257%]

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

  • 🟥 execution_time [+298.411ms; +301.694ms] or [+149.391%; +151.035%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+298.213ms; +300.272ms] or [+148.632%; +149.658%]

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

  • 🟥 execution_time [+298.842ms; +316.176ms] or [+150.064%; +158.769%]

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

  • 🟥 execution_time [+301.887ms; +305.326ms] or [+153.098%; +154.842%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.849ms; +301.772ms] or [+150.065%; +150.525%]
  • 🟩 throughput [+60981199.325op/s; +61328857.833op/s] or [+44.410%; +44.663%]

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

  • unstable execution_time [+323.119ms; +394.321ms] or [+401.855%; +490.409%]

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

  • 🟥 execution_time [+298.972ms; +299.972ms] or [+149.121%; +149.619%]

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

  • 🟩 throughput [+76449.914op/s; +91778.746op/s] or [+7.138%; +8.569%]

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

  • 🟩 throughput [+45081.724op/s; +64554.658op/s] or [+5.218%; +7.472%]

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

  • 🟩 throughput [+83499.082op/s; +114732.949op/s] or [+6.463%; +8.881%]

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

  • 🟩 throughput [+74064.249op/s; +83579.307op/s] or [+7.356%; +8.301%]

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

  • 🟩 throughput [+54008.254op/s; +58842.345op/s] or [+9.807%; +10.685%]

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

  • 🟩 throughput [+23762.163op/s; +33452.792op/s] or [+5.319%; +7.488%]

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

  • 🟩 throughput [+88804.997op/s; +110145.273op/s] or [+9.922%; +12.306%]

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.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0
  • 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 netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • 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.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@datadog-datadog-prod-us1-2

This comment has been minimized.

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented May 20, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8666) 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.82 ± (72.88 - 73.30) ms73.04 ± (73.15 - 73.59) ms+0.3%✅⬆️
.NET Framework 4.8 - Bailout
duration76.83 ± (76.74 - 77.12) ms77.23 ± (77.18 - 77.55) ms+0.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1113.77 ± (1112.61 - 1120.81) ms1113.91 ± (1114.06 - 1123.02) ms+0.0%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.43 ± (22.38 - 22.47) ms22.68 ± (22.59 - 22.77) ms+1.1%✅⬆️
process.time_to_main_ms84.86 ± (84.66 - 85.07) ms85.65 ± (85.26 - 86.03) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.92 ± (10.91 - 10.92) MB10.94 ± (10.93 - 10.94) MB+0.2%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.69 ± (22.64 - 22.74) ms22.83 ± (22.77 - 22.88) ms+0.6%✅⬆️
process.time_to_main_ms88.64 ± (88.37 - 88.92) ms88.87 ± (88.56 - 89.18) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.95) MB10.97 ± (10.96 - 10.97) MB+0.2%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms213.13 ± (212.20 - 214.07) ms211.71 ± (210.91 - 212.51) ms-0.7%
process.time_to_main_ms539.51 ± (538.21 - 540.80) ms540.79 ± (539.52 - 542.06) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.64 ± (48.61 - 48.67) MB48.58 ± (48.55 - 48.60) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.1%
.NET 6 - Baseline
process.internal_duration_ms21.64 ± (21.58 - 21.70) ms21.74 ± (21.68 - 21.80) ms+0.5%✅⬆️
process.time_to_main_ms76.44 ± (76.18 - 76.71) ms77.07 ± (76.79 - 77.35) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.62 ± (10.62 - 10.62) MB10.64 ± (10.64 - 10.64) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.11 ± (21.07 - 21.14) ms21.42 ± (21.36 - 21.48) ms+1.5%✅⬆️
process.time_to_main_ms75.05 ± (74.86 - 75.25) ms76.79 ± (76.50 - 77.08) ms+2.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.74 ± (10.73 - 10.74) MB10.76 ± (10.75 - 10.76) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms369.73 ± (367.67 - 371.79) ms373.63 ± (371.49 - 375.76) ms+1.1%✅⬆️
process.time_to_main_ms548.90 ± (547.48 - 550.32) ms551.42 ± (549.73 - 553.11) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.00 ± (49.98 - 50.03) MB50.04 ± (50.02 - 50.07) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.35 ± (19.31 - 19.40) ms19.35 ± (19.32 - 19.38) ms-0.0%
process.time_to_main_ms72.59 ± (72.38 - 72.79) ms72.64 ± (72.48 - 72.81) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.67) MB7.68 ± (7.67 - 7.68) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.57 ± (19.53 - 19.62) ms19.77 ± (19.72 - 19.83) ms+1.0%✅⬆️
process.time_to_main_ms75.86 ± (75.60 - 76.12) ms77.38 ± (77.10 - 77.66) ms+2.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.73 ± (7.72 - 7.74) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms294.56 ± (292.34 - 296.77) ms292.79 ± (290.92 - 294.67) ms-0.6%
process.time_to_main_ms495.99 ± (494.85 - 497.13) ms498.96 ± (497.58 - 500.33) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.95 ± (36.92 - 36.97) MB36.89 ± (36.86 - 36.93) 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.72 ± (201.29 - 202.12) ms202.31 ± (201.90 - 202.93) ms+0.3%✅⬆️
.NET Framework 4.8 - Bailout
duration205.55 ± (205.24 - 205.95) ms206.33 ± (205.86 - 206.72) ms+0.4%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1204.09 ± (1203.07 - 1209.50) ms1202.45 ± (1202.90 - 1209.52) ms-0.1%
.NET Core 3.1 - Baseline
process.internal_duration_ms196.37 ± (196.02 - 196.71) ms196.50 ± (196.08 - 196.92) ms+0.1%✅⬆️
process.time_to_main_ms85.02 ± (84.66 - 85.38) ms85.12 ± (84.84 - 85.40) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.02 ± (15.99 - 16.04) MB16.04 ± (16.01 - 16.06) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.0%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms196.05 ± (195.62 - 196.48) ms195.77 ± (195.27 - 196.27) ms-0.1%
process.time_to_main_ms85.93 ± (85.68 - 86.19) ms86.28 ± (86.00 - 86.56) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.07 ± (16.04 - 16.10) MB16.09 ± (16.07 - 16.12) MB+0.1%✅⬆️
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (21 - 21)+0.4%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms388.20 ± (386.87 - 389.53) ms391.05 ± (389.95 - 392.15) ms+0.7%✅⬆️
process.time_to_main_ms540.05 ± (538.74 - 541.37) ms543.69 ± (542.34 - 545.04) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.96 ± (57.73 - 58.18) MB58.14 ± (57.92 - 58.35) MB+0.3%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.4%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms201.02 ± (200.50 - 201.53) ms199.38 ± (198.95 - 199.80) ms-0.8%
process.time_to_main_ms73.33 ± (73.00 - 73.67) ms73.32 ± (73.05 - 73.60) ms-0.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.27 ± (16.24 - 16.30) MB16.29 ± (16.26 - 16.32) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.1%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms200.75 ± (200.29 - 201.21) ms198.77 ± (198.39 - 199.15) ms-1.0%
process.time_to_main_ms74.43 ± (74.19 - 74.66) ms74.14 ± (73.92 - 74.36) ms-0.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.32 ± (16.30 - 16.35) MB16.34 ± (16.32 - 16.36) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.8%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms587.55 ± (584.83 - 590.27) ms588.37 ± (586.04 - 590.71) ms+0.1%✅⬆️
process.time_to_main_ms548.76 ± (547.72 - 549.80) ms547.95 ± (546.92 - 548.99) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.10 ± (61.01 - 61.20) MB61.10 ± (61.01 - 61.19) MB-0.0%
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)-0.0%
.NET 8 - Baseline
process.internal_duration_ms197.87 ± (197.42 - 198.31) ms196.26 ± (195.81 - 196.71) ms-0.8%
process.time_to_main_ms72.80 ± (72.52 - 73.08) ms72.77 ± (72.52 - 73.02) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.74 ± (11.71 - 11.76) MB11.74 ± (11.72 - 11.76) MB+0.1%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.3%
.NET 8 - Bailout
process.internal_duration_ms198.20 ± (197.67 - 198.72) ms195.40 ± (194.89 - 195.91) ms-1.4%
process.time_to_main_ms73.91 ± (73.61 - 74.20) ms73.24 ± (73.02 - 73.46) ms-0.9%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.74 ± (11.72 - 11.76) MB11.77 ± (11.75 - 11.79) MB+0.2%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms511.12 ± (508.36 - 513.88) ms513.57 ± (510.98 - 516.16) ms+0.5%✅⬆️
process.time_to_main_ms495.73 ± (494.86 - 496.60) ms496.85 ± (495.91 - 497.79) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.66 ± (50.62 - 50.70) MB50.64 ± (50.60 - 50.68) MB-0.0%
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (30 - 30)+0.8%✅⬆️
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 (8666) - mean (73ms)  : 70, 77
    master - mean (73ms)  : 70, 76

    section Bailout
    This PR (8666) - mean (77ms)  : 75, 80
    master - mean (77ms)  : 75, 79

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (1,119ms)  : 1051, 1186
    master - mean (1,117ms)  : 1055, 1179

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 (8666) - mean (115ms)  : 107, 124
    master - mean (114ms)  : 109, 119

    section Bailout
    This PR (8666) - mean (119ms)  : 113, 126
    master - mean (118ms)  : 113, 124

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (790ms)  : 758, 823
    master - mean (787ms)  : 764, 810

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8666) - mean (106ms)  : 100, 111
    master - mean (105ms)  : 100, 110

    section Bailout
    This PR (8666) - mean (105ms)  : 99, 111
    master - mean (103ms)  : 100, 105

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (953ms)  : 914, 992
    master - mean (945ms)  : 909, 982

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8666) - mean (100ms)  : 96, 103
    master - mean (100ms)  : 95, 105

    section Bailout
    This PR (8666) - mean (105ms)  : 99, 111
    master - mean (104ms)  : 99, 108

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (825ms)  : 784, 865
    master - mean (821ms)  : 787, 854

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 (8666) - mean (202ms)  : 197, 208
    master - mean (202ms)  : 197, 207

    section Bailout
    This PR (8666) - mean (206ms)  : 202, 210
    master - mean (206ms)  : 202, 209

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (1,206ms)  : 1158, 1255
    master - mean (1,206ms)  : 1160, 1253

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 (8666) - mean (291ms)  : 282, 300
    master - mean (291ms)  : 284, 298

    section Bailout
    This PR (8666) - mean (291ms)  : 283, 299
    master - mean (291ms)  : 284, 297

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (975ms)  : 947, 1002
    master - mean (969ms)  : 950, 988

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8666) - mean (281ms)  : 274, 288
    master - mean (283ms)  : 277, 290

    section Bailout
    This PR (8666) - mean (282ms)  : 275, 288
    master - mean (283ms)  : 277, 290

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (1,166ms)  : 1122, 1209
    master - mean (1,164ms)  : 1119, 1208

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8666) - mean (279ms)  : 271, 287
    master - mean (281ms)  : 274, 287

    section Bailout
    This PR (8666) - mean (279ms)  : 272, 285
    master - mean (282ms)  : 276, 288

    section CallTarget+Inlining+NGEN
    This PR (8666) - mean (1,045ms)  : 1006, 1084
    master - mean (1,040ms)  : 997, 1083

Loading

@tonyredondo
tonyredondo marked this pull request as ready for review May 20, 2026 19:52
@tonyredondo
tonyredondo requested a review from a team as a code owner May 20, 2026 19:52

@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: 6310ea5eb2

ℹ️ 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.Coverage.collector/AssemblyProcessor.cs Outdated

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 addresses Windows file-locking failures in the CI Visibility coverage collector when multiple test assemblies are rewritten in parallel. It introduces an owned Cecil resolver that reads assemblies in-memory and coordinates per-assembly read/write access to prevent dependency reads from racing with target assembly writes (fixing issue #8592).

Changes:

  • Introduce CoverageAssemblyResolver that caches/owns AssemblyDefinition instances, reads dependencies in-memory, and disposes assemblies to avoid lingering file handles.
  • Add CoverageAssemblyPathLock to provide per-assembly-path read/write locking and integrate it into target read/write and dependency resolution paths.
  • Refactor CoverageCollector retry logic and add focused resolver/locking unit tests.

Reviewed changes

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

Show a summary per file
File Description
tracer/src/Datadog.Trace.Coverage.collector/AssemblyProcessor.cs Switch to the new owned resolver and add locked in-memory read + locked write helpers for the target assembly.
tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyResolver.cs New resolver that reads dependencies in-memory under per-path read locks and caches/disposes Cecil assemblies.
tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyPathLock.cs New per-path ReaderWriterLockSlim registry used to coordinate dependency reads vs. target writes.
tracer/src/Datadog.Trace.Coverage.collector/CoverageCollector.cs Replace goto retry with a bounded attempt loop and avoid logging stale IO failures after success/skip.
tracer/test/Datadog.Trace.Tools.Runner.Tests/CoverageResolverTests.cs New tests covering resolver caching/disposal and the per-path locking behavior (including Windows-only exclusive handle assertions).
tracer/test/Datadog.Trace.Tools.Runner.Tests/Datadog.Trace.Tools.Runner.Tests.csproj Add Mono.Cecil reference needed by the new resolver tests.

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

Comment thread tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyResolver.cs Outdated
Comment thread tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyResolver.cs Outdated
Comment thread tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyPathLock.cs Outdated

@andrewlock andrewlock left a comment

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.

LGTM as best as I can tell 😅

In the prod code, I've entirely just flagged stylistict and perf things, but I'm not sure how much of a concern the perf/allocation side is, so feel free to ignore.

In the tests, I have significant concerns about the use of timeouts and delays - these look practically guaranteed to flake in our overloaded CI. We should bump up "timeouts" that we expect to never fail to huge values, and ideally don't rely on timings at all, to keep the steps deterministic

Comment thread tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyPathLock.cs Outdated
Comment thread tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyResolver.cs Outdated
Comment thread tracer/src/Datadog.Trace.Coverage.collector/CoverageAssemblyResolver.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tools.Runner.Tests/CoverageResolverTests.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tools.Runner.Tests/CoverageResolverTests.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tools.Runner.Tests/CoverageResolverTests.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tools.Runner.Tests/CoverageResolverTests.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tools.Runner.Tests/CoverageResolverTests.cs Outdated

@andrewlock andrewlock left a comment

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.

Thanks!

@tonyredondo
tonyredondo merged commit 15da03b into master May 21, 2026
138 checks passed
@tonyredondo
tonyredondo deleted the feat/coverage-resolver-file-locks branch May 21, 2026 16:08
@github-actions github-actions Bot added this to the vNext-v3 milestone May 21, 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.

[BUG]: DataDog.Trace.Coverage.collector > System.IO.IOException when processing DLLs to instrument

3 participants