Skip to content

[Test Optimization] ci: git caching + env improvements#8072

Merged
tonyredondo merged 8 commits intomasterfrom
tony/testoptimization-performance-work-pr3
Feb 3, 2026
Merged

[Test Optimization] ci: git caching + env improvements#8072
tonyredondo merged 8 commits intomasterfrom
tony/testoptimization-performance-work-pr3

Conversation

@tonyredondo
Copy link
Member

@tonyredondo tonyredondo commented Jan 15, 2026

Summary of changes

  • Add git command caching and telemetry improvements for CI visibility.
  • Update GitInfo discovery and CI environment logging.
  • Update impacted tests for new git discovery behavior.

JIRA: SDTEST-3226

Reason for change

Reduce git command overhead and improve visibility into CI git metadata collection.

Implementation details

  • Disk cache keyed by RunId in GitCommandHelper with safe.directory handling.
  • JSON annotations in ProcessHelpers for cache serialization.
  • Adjusted CI runner git discovery logic and tests.

Test coverage

CI passes then all changes are good.

Other details

@tonyredondo tonyredondo changed the title ci: git caching + env improvements [Test Optimization] ci: git caching + env improvements Jan 15, 2026
@pr-commenter
Copy link

pr-commenter bot commented Jan 15, 2026

Benchmarks

Benchmark execution time: 2026-02-03 10:08:16

Comparing candidate commit 9debeb5 in PR branch tony/testoptimization-performance-work-pr3 with baseline commit 84e3d8c in branch master.

Found 7 performance improvements and 9 performance regressions! Performance is the same for 160 metrics, 16 unstable metrics.

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

  • 🟩 throughput [+6678.532op/s; +8778.207op/s] or [+5.697%; +7.488%]

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

  • 🟩 execution_time [-16.108ms; -11.844ms] or [-7.655%; -5.628%]

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

  • 🟥 execution_time [+22.614ms; +22.986ms] or [+12.486%; +12.691%]

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

  • 🟩 execution_time [-19.332ms; -18.729ms] or [-9.593%; -9.293%]

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

  • 🟥 execution_time [+20.692ms; +22.053ms] or [+21.588%; +23.008%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+12.758ms; +17.582ms] or [+6.393%; +8.810%]
  • 🟥 throughput [-98.614op/s; -71.471op/s] or [-8.198%; -5.941%]

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

  • 🟥 execution_time [+8.530ms; +13.454ms] or [+5.378%; +8.482%]

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

  • 🟩 execution_time [-195.785µs; -190.735µs] or [-9.297%; -9.057%]
  • 🟩 throughput [+47.343op/s; +48.622op/s] or [+9.970%; +10.239%]

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

  • 🟩 throughput [+28885.746op/s; +40358.594op/s] or [+5.298%; +7.402%]

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

  • 🟩 execution_time [-15.321ms; -11.481ms] or [-7.486%; -5.610%]

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

  • 🟥 execution_time [+23.402ms; +26.230ms] or [+13.666%; +15.317%]

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

  • 🟥 execution_time [+10.912ms; +14.956ms] or [+5.569%; +7.633%]

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

  • 🟥 throughput [-72112.521op/s; -67854.378op/s] or [-5.404%; -5.085%]

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

  • 🟥 execution_time [+10.667ms; +16.360ms] or [+5.377%; +8.246%]

@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from d68d0a9 to de740b1 Compare January 15, 2026 22:06
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from 50fc18c to 2018124 Compare January 15, 2026 22:06
@datadog-official

This comment has been minimized.

@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Jan 15, 2026

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8072) 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
duration73.29 ± (73.40 - 73.80) ms72.27 ± (72.26 - 72.57) ms-1.4%
.NET Framework 4.8 - Bailout
duration78.18 ± (77.92 - 78.21) ms77.82 ± (77.82 - 78.27) ms-0.5%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1058.99 ± (1061.87 - 1069.43) ms1052.37 ± (1052.14 - 1057.70) ms-0.6%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.68 ± (22.64 - 22.73) ms22.58 ± (22.53 - 22.62) ms-0.5%
process.time_to_main_ms85.71 ± (85.51 - 85.90) ms84.62 ± (84.43 - 84.81) ms-1.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.95) MB10.95 ± (10.95 - 10.96) MB+0.1%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.58 ± (22.54 - 22.63) ms22.53 ± (22.49 - 22.58) ms-0.2%
process.time_to_main_ms87.29 ± (87.09 - 87.50) ms85.54 ± (85.36 - 85.73) ms-2.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.98 ± (10.97 - 10.98) MB10.99 ± (10.99 - 11.00) MB+0.1%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms246.39 ± (242.38 - 250.41) ms256.36 ± (252.64 - 260.09) ms+4.0%✅⬆️
process.time_to_main_ms500.97 ± (500.21 - 501.73) ms493.81 ± (493.10 - 494.51) ms-1.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.60 ± (48.57 - 48.63) MB48.69 ± (48.66 - 48.71) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.8%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.46 ± (21.42 - 21.50) ms21.28 ± (21.25 - 21.32) ms-0.8%
process.time_to_main_ms74.69 ± (74.49 - 74.88) ms72.95 ± (72.77 - 73.13) ms-2.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.65 - 10.66) MB10.66 ± (10.66 - 10.66) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.40 ± (21.35 - 21.44) ms21.18 ± (21.13 - 21.22) ms-1.0%
process.time_to_main_ms75.56 ± (75.37 - 75.75) ms73.98 ± (73.78 - 74.19) ms-2.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.70 ± (10.69 - 10.70) MB10.77 ± (10.77 - 10.78) MB+0.7%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms236.00 ± (232.05 - 239.94) ms239.01 ± (235.34 - 242.69) ms+1.3%✅⬆️
process.time_to_main_ms475.27 ± (474.53 - 476.02) ms470.66 ± (469.85 - 471.48) ms-1.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.25 ± (49.23 - 49.28) MB49.33 ± (49.30 - 49.36) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.43 ± (19.39 - 19.46) ms19.40 ± (19.36 - 19.43) ms-0.2%
process.time_to_main_ms73.37 ± (73.20 - 73.53) ms71.87 ± (71.73 - 72.02) ms-2.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.68 ± (7.67 - 7.69) MB7.70 ± (7.69 - 7.70) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.56 ± (19.52 - 19.61) ms19.45 ± (19.42 - 19.48) ms-0.6%
process.time_to_main_ms74.89 ± (74.70 - 75.08) ms73.43 ± (73.26 - 73.60) ms-2.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.75 ± (7.74 - 7.77) MB7.76 ± (7.75 - 7.77) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms186.62 ± (185.86 - 187.38) ms184.86 ± (184.23 - 185.50) ms-0.9%
process.time_to_main_ms456.71 ± (455.75 - 457.67) ms452.74 ± (451.87 - 453.60) ms-0.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.83 ± (36.79 - 36.86) MB36.78 ± (36.76 - 36.81) MB-0.1%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.5%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration197.35 ± (197.04 - 197.95) ms197.21 ± (197.10 - 198.15) ms-0.1%
.NET Framework 4.8 - Bailout
duration202.10 ± (202.15 - 203.07) ms200.38 ± (200.09 - 200.85) ms-0.9%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1164.83 ± (1165.96 - 1175.87) ms1154.89 ± (1157.40 - 1165.86) ms-0.9%
.NET Core 3.1 - Baseline
process.internal_duration_ms191.68 ± (191.28 - 192.07) ms191.25 ± (190.84 - 191.67) ms-0.2%
process.time_to_main_ms83.13 ± (82.90 - 83.37) ms83.12 ± (82.86 - 83.37) ms-0.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.16 ± (16.14 - 16.19) MB16.19 ± (16.16 - 16.21) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.3%
.NET Core 3.1 - Bailout
process.internal_duration_ms192.27 ± (191.81 - 192.73) ms191.32 ± (190.84 - 191.80) ms-0.5%
process.time_to_main_ms84.69 ± (84.49 - 84.89) ms84.61 ± (84.40 - 84.82) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.19 ± (16.16 - 16.22) MB16.20 ± (16.17 - 16.22) MB+0.0%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)-0.1%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms433.48 ± (430.61 - 436.34) ms437.30 ± (434.68 - 439.92) ms+0.9%✅⬆️
process.time_to_main_ms489.41 ± (488.78 - 490.04) ms488.78 ± (488.08 - 489.49) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed59.11 ± (58.99 - 59.22) MB59.05 ± (58.94 - 59.15) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 6 - Baseline
process.internal_duration_ms196.25 ± (195.88 - 196.62) ms196.87 ± (196.38 - 197.36) ms+0.3%✅⬆️
process.time_to_main_ms72.33 ± (72.08 - 72.59) ms72.24 ± (72.05 - 72.43) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.42 ± (16.39 - 16.45) MB16.42 ± (16.40 - 16.45) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.4%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms196.18 ± (195.70 - 196.65) ms195.92 ± (195.49 - 196.34) ms-0.1%
process.time_to_main_ms73.32 ± (73.13 - 73.52) ms72.87 ± (72.65 - 73.08) ms-0.6%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.41 ± (16.38 - 16.43) MB16.43 ± (16.40 - 16.45) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.2%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms437.86 ± (433.98 - 441.74) ms445.78 ± (442.51 - 449.05) ms+1.8%✅⬆️
process.time_to_main_ms466.22 ± (465.61 - 466.83) ms466.20 ± (465.59 - 466.82) ms-0.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed59.17 ± (59.02 - 59.31) MB58.95 ± (58.80 - 59.09) MB-0.4%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.2%
.NET 8 - Baseline
process.internal_duration_ms195.05 ± (194.68 - 195.42) ms195.45 ± (194.92 - 195.97) ms+0.2%✅⬆️
process.time_to_main_ms72.05 ± (71.85 - 72.26) ms72.12 ± (71.89 - 72.36) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.79 ± (11.77 - 11.82) MB11.77 ± (11.75 - 11.79) MB-0.2%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.4%
.NET 8 - Bailout
process.internal_duration_ms195.11 ± (194.58 - 195.64) ms193.83 ± (193.40 - 194.26) ms-0.7%
process.time_to_main_ms73.10 ± (72.92 - 73.28) ms72.76 ± (72.60 - 72.93) ms-0.5%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.82 ± (11.80 - 11.84) MB11.82 ± (11.80 - 11.84) MB-0.0%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.3%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms372.42 ± (371.03 - 373.82) ms371.00 ± (369.73 - 372.28) ms-0.4%
process.time_to_main_ms449.96 ± (449.34 - 450.59) ms451.28 ± (450.58 - 451.98) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed48.50 ± (48.47 - 48.52) MB48.43 ± (48.40 - 48.46) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.1%
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 (8072) - mean (72ms)  : 70, 75
    master - mean (74ms)  : 70, 77

    section Bailout
    This PR (8072) - mean (78ms)  : 75, 81
    master - mean (78ms)  : 77, 79

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (1,055ms)  : 1015, 1095
    master - mean (1,066ms)  : 1011, 1120

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 (8072) - mean (114ms)  : 110, 119
    master - mean (116ms)  : 113, 119

    section Bailout
    This PR (8072) - mean (115ms)  : 112, 117
    master - mean (117ms)  : 114, 120

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (788ms)  : 736, 841
    master - mean (788ms)  : 730, 845

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8072) - mean (100ms)  : 97, 104
    master - mean (103ms)  : 99, 107

    section Bailout
    This PR (8072) - mean (102ms)  : 98, 105
    master - mean (104ms)  : 101, 106

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (745ms)  : 678, 813
    master - mean (747ms)  : 675, 818

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

    section Bailout
    This PR (8072) - mean (101ms)  : 98, 103
    master - mean (102ms)  : 100, 105

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (678ms)  : 647, 708
    master - mean (685ms)  : 666, 705

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 (8072) - mean (198ms)  : 191, 204
    master - mean (197ms)  : 192, 203

    section Bailout
    This PR (8072) - mean (200ms)  : 197, 204
    master - mean (203ms)  : 196, 209

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (1,162ms)  : 1101, 1223
    master - mean (1,171ms)  : 1096, 1246

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 (8072) - mean (284ms)  : 277, 291
    master - mean (284ms)  : 277, 291

    section Bailout
    This PR (8072) - mean (285ms)  : 279, 290
    master - mean (286ms)  : 279, 292

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (963ms)  : 908, 1018
    master - mean (962ms)  : 915, 1009

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8072) - mean (278ms)  : 270, 286
    master - mean (277ms)  : 271, 283

    section Bailout
    This PR (8072) - mean (277ms)  : 272, 283
    master - mean (278ms)  : 270, 286

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (947ms)  : 884, 1009
    master - mean (941ms)  : 873, 1008

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8072) - mean (278ms)  : 271, 285
    master - mean (277ms)  : 271, 283

    section Bailout
    This PR (8072) - mean (277ms)  : 270, 284
    master - mean (279ms)  : 270, 287

    section CallTarget+Inlining+NGEN
    This PR (8072) - mean (856ms)  : 831, 881
    master - mean (855ms)  : 828, 881

Loading

@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from de740b1 to a92777c Compare January 16, 2026 11:38
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from b98a4d3 to e77015c Compare January 16, 2026 11:38
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from a92777c to d0595bf Compare January 16, 2026 12:31
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from e77015c to 8fae54a Compare January 16, 2026 12:32
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from d0595bf to 7216d32 Compare January 16, 2026 12:39
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from 8fae54a to 33077cb Compare January 16, 2026 12:39
Comment on lines +113 to +123
if (gitInfo.Errors.Count > 0)
{
var sb = StringBuilderCache.Acquire();
sb.AppendLine();
foreach (var err in gitInfo.Errors)
{
sb.AppendLine(" Error: " + err);
}

Log.Warning("CIEnvironmentValues: Errors detected in the local gitInfo: {Errors}", StringBuilderCache.GetStringAndRelease(sb));
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Before this we were swallowing all the git errors when extracting the local git info (without any ci provider info)

Comment on lines +125 to +140
if (Log.IsEnabled(LogEventLevel.Debug))
{
var sb = StringBuilderCache.Acquire();
sb.AppendLine();
var values = ValueProvider.GetValues();
foreach (var field in typeof(CIEnvironmentValues.Constants).GetFields())
{
var fieldName = field.GetValue(null) as string;
if (!StringUtil.IsNullOrEmpty(fieldName) && values.TryGetValue<string>(fieldName, out var value))
{
sb.AppendFormat("\t{0}={1}{2}", fieldName, value == string.Empty ? "(empty)" : $"\"{value}\"", Environment.NewLine);
}
}

Log.Debug("CIEnvironmentValues: Values detected:{Values}", StringBuilderCache.GetStringAndRelease(sb));
}
Copy link
Member Author

Choose a reason for hiding this comment

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

To help to debug issues in the CI providers parser here we dump the environment variables defined in the Contants class related to the CI Providers environment variables.

Comment on lines -35 to -45
// Ensure we have permissions to read the git directory
var safeDirectory = ProcessHelpers.RunCommand(
new ProcessHelpers.Command(
cmd: "git",
arguments: $"config --global --add safe.directory {gitDirectory.FullName}",
workingDirectory: gitDirectory.FullName,
useWhereIsIfFileNotFound: true));
if (safeDirectory?.ExitCode != 0)
{
localGitInfo.Errors.Add($"Error setting safe.directory: {safeDirectory?.Error}");
}
Copy link
Member Author

Choose a reason for hiding this comment

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

we no longer need to modify the git global configuration, we will use the -c safe.directory option on each git command call.

}

// Get the repository URL
var repositoryOutput = ProcessHelpers.RunCommand(
Copy link
Member Author

Choose a reason for hiding this comment

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

we already have a helper to call git commands

Comment on lines +128 to +135
var baseDirectory = AppContext.BaseDirectory;
if (!baseDirectory.Contains("/dotnet/sdk") && !string.IsNullOrWhiteSpace(RuntimeFolder) && !baseDirectory.Contains(RuntimeFolder))
{
if (!File.Exists(Path.Combine(baseDirectory, DatadogTraceToolsRunnerAssembly)))
{
searchPaths.Add(baseDirectory);
}
}
Copy link
Member Author

@tonyredondo tonyredondo Jan 16, 2026

Choose a reason for hiding this comment

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

for the testhost process the base directory is the dotnet sdk, so we need to check that before considering it as a search path for the git metadata.

Comment on lines +46 to +86
if (useCache && string.IsNullOrEmpty(input))
{
string runId;
if (TestOptimization.Instance is TestOptimization { } tOpt)
{
runId = tOpt.EnsureRunId(workingDirectory);
}
else
{
runId = TestOptimization.Instance.RunId;
}

var cacheFolder = Path.Combine(workingDirectory, ".dd", runId, "git");
try
{
if (!Directory.Exists(cacheFolder))
{
Directory.CreateDirectory(cacheFolder);
}

lock (Hasher)
{
var hash = Hasher.ComputeHash(Encoding.UTF8.GetBytes(arguments));
cacheKey = Path.Combine(cacheFolder, BitConverter.ToString(hash).ToLowerInvariant() + ".json");
}

if (File.Exists(cacheKey))
{
var jsonValue = File.ReadAllText(cacheKey);
if (JsonConvert.DeserializeObject<ProcessHelpers.CommandOutput>(jsonValue) is { } cachedOutput)
{
cachedOutput.Cached = true;
return cachedOutput;
}
}
}
catch (Exception ex)
{
Log.Warning(ex, "Error in the git cache.");
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

this prepares the cache folder for the git commands, so we avoid running the same git commands over and over again from different processes (that's the issue with test optimization, involves multiple processes per run)

try
{
var sw = System.Diagnostics.Stopwatch.StartNew();
arguments = $"-c safe.directory={workingDirectory} {arguments}";
Copy link
Member Author

Choose a reason for hiding this comment

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

here's the -c safe.directory to avoid changing the global git configuration.

Copy link
Member Author

Choose a reason for hiding this comment

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

we need to make this serializable for the git commands cache

Directory.Exists(testItem.GitFolderPath).Should().BeTrue();

// Let's try with the git info provider based on manual parsing of the git folder
if (!ManualParserGitInfoProvider.Instance.TryGetFrom(testItem.GitFolderPath, out var gitInfo))
Copy link
Member Author

Choose a reason for hiding this comment

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

we are removing the ManualParser provider, because we now always need the git command, so it doesn't worth having a manual .git folder parser.

@tonyredondo tonyredondo marked this pull request as ready for review January 16, 2026 14:36
@tonyredondo tonyredondo requested review from a team as code owners January 16, 2026 14:36
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from 7216d32 to 4a70c7a Compare January 19, 2026 09:19
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from 07b09e0 to 566cf1c Compare January 19, 2026 09:19
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from 4a70c7a to b3116fd Compare January 19, 2026 09:27
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from 566cf1c to 87c7fd2 Compare January 19, 2026 09:28
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from b3116fd to 643a4d8 Compare January 23, 2026 14:46
@tonyredondo tonyredondo requested review from a team as code owners January 23, 2026 14:46
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from 87c7fd2 to 2f8135c Compare January 23, 2026 15:31
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from 643a4d8 to 36cf4ce Compare January 23, 2026 17:27
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from eee4289 to 882dbe0 Compare January 23, 2026 17:28
tonyredondo added a commit that referenced this pull request Jan 30, 2026
## Summary of changes
- Add FixedSizeArrayPool and logger overloads to reduce per-log
allocations.
- Add RefStopwatch/StopwatchHelpers/CodeDuration and apply timing to
TraceClock/TracerManagerFactory/Instrumentation and CI processors.
- Lower init logs to Debug for CI protocol writer/sender and processors.

## Reason for change
Reduce allocations and improve timing diagnostics in hot paths.

## Implementation details
- New utility helpers in `Datadog.Trace.Util` for allocation-free timing
and pooling.
- Logging changes to avoid params array allocations in common log paths.
- Timing/log-level tweaks in CI protocol writer/sender and trace
processors.

## Test coverage
CI passes then all changes are good.

## Other details
- Stacked PRs (current marked):
- **CURRENT**: PR1 #8070
  - PR2 #8071
  - PR3 #8072
  - PR4 #8073
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr2 branch from 36cf4ce to 1e2d8dd Compare February 2, 2026 12:55
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from 882dbe0 to 2131bb0 Compare February 2, 2026 17:08
tonyredondo added a commit that referenced this pull request Feb 3, 2026
## Summary of changes
- Introduce Test Optimization RunId and EnsureRunId with cache folder
lifecycle.
- Add `_DD_INTERNAL_TOPT_RUNID` to config mapping/docs and regenerate
keys.
- Update CI integration tests to set/print RunId for deterministic runs.
- Adjust test helper thread naming for clearer CI debugging.

## Reason for change
Provide a stable RunId before caching work that depends on it and keep
configuration in sync.

## Implementation details
- Add RunId/EnsureRunId to `ITestOptimization`/`TestOptimization` with
environment propagation.
- Update configuration mapping and generated CI visibility keys.
- Update CI integration tests for RunId coverage.

## Test coverage
CI passes then all changes are good.

## Other details
- Stacked PRs (current marked):
  - PR1 #8070
- **CURRENT**: PR2 #8071
  - PR3 #8072
  - PR4 #8073
Base automatically changed from tony/testoptimization-performance-work-pr2 to master February 3, 2026 09:23
@tonyredondo tonyredondo force-pushed the tony/testoptimization-performance-work-pr3 branch from b8c4942 to 9debeb5 Compare February 3, 2026 09:26
@tonyredondo tonyredondo merged commit 7c6440c into master Feb 3, 2026
142 checks passed
@tonyredondo tonyredondo deleted the tony/testoptimization-performance-work-pr3 branch February 3, 2026 11:33
@github-actions github-actions bot added this to the vNext-v3 milestone Feb 3, 2026
tonyredondo added a commit that referenced this pull request Feb 3, 2026
## Summary of changes
- Add cached/file Test Optimization clients and update client wrappers.
- Reduce feature init overhead and adjust background initialization.
- Improve runner logging and CI workspace cache usage.

## Reason for change
Reduce repeated HTTP calls and improve initialization performance for CI
visibility features.

## Implementation details
- New cached/file client implementations for disk/memory caching.
- Feature creation updated to reduce dependencies on client calls.
- CodeDuration instrumentation added to CI initialization paths.

## Test coverage
CI passes then all changes are good.

## Other details
- Stacked PRs (current marked):
  - PR1 #8070
  - PR2 #8071
  - PR3 #8072
- **CURRENT**: PR4 #8073
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