Skip to content

[Runtime Metrics] Enables Runtime Metrics by Default for .NET 6+#8267

Open
link04 wants to merge 5 commits intomasterfrom
maximo/enable-runtime-metrics-default
Open

[Runtime Metrics] Enables Runtime Metrics by Default for .NET 6+#8267
link04 wants to merge 5 commits intomasterfrom
maximo/enable-runtime-metrics-default

Conversation

@link04
Copy link
Contributor

@link04 link04 commented Mar 3, 2026

Summary of changes

Enable runtime metrics by default on .NET 6+ using the Diagnostics listener for services where the config is unset otherwise continue to use EventListener, and default existing explicit users to Diagnostics on .NET 8+ since there is no loss of ASP.NET Core Metrics.

Reason for change

Runtime metrics are currently opt-in. The EventListener/EventPipe implementation has known runtime bugs: shutdown crashes (dotnet/runtime#103480) and CPU/memory leaks (dotnet/runtime#111368). The Diagnostics listener avoids these and has comparable or better performance in our tests.

See RFC: Enabling .NET Runtime Metrics by Default — Option A.

Implementation details

Configuration logic for DD_RUNTIME_METRICS_ENABLED:

  • If explicitly set, use that value
  • If not set, default to true on .NET 6+

Configuration logic for DD_RUNTIME_METRICS_DIAGNOSTICS_METRICS_API_ENABLED:

  • If explicitly set, use that value
  • If not set:
    • .NET 8+: defaults to true (full metric coverage including ASP.NET Core meters)
    • .NET 6/7 with DD_RUNTIME_METRICS_ENABLED not set: defaults to true
    • .NET 6/7 with DD_RUNTIME_METRICS_ENABLED=true: defaults to false (keeps EventListener to preserve ASP.NET Core EventCounter metrics)

The .NET 8 check uses Environment.Version.Major >= 8.

Also fixes RuntimeMetricsWriter to dispose DiagnosticsMetricsRuntimeMetricsListener on .NET 6+ (MeterListener is safe to dispose, unlike EventListener).

Test coverage

  • Updated conditional [InlineData] in RuntimeMetricsEnabled test to expect true when unset on .NET 6+.
  • Added RuntimeMetrics_DefaultsToDignosticsOnNet6Plus_WhenNotExplicitlySet.
  • Added RuntimeMetrics_ExplicitEnable_RespectsExplicitDiagnosticsFlag (explicit true/false cases).
  • Added RuntimeMetrics_ExplicitEnable_DefaultsToDiagnosticsOnNet8Plus (net8.0 TFM).
  • Added RuntimeMetrics_ExplicitEnable_DefaultsToEventListenerOnNet6And7 (net6.0/net7.0 TFMs).
  • Added RuntimeMetrics_ExplicitDisable_OverridesDefault.
  • All 21 RuntimeMetrics configuration tests pass.

Other details

Part of Enabling .NET Runtime Metrics by Default. Should land after the PRs below are merged which include necessary fixes:

Moving forward

After this lands, monitor:

  1. Telemetry: DD_RUNTIME_METRICS_ENABLED and DD_RUNTIME_METRICS_DIAGNOSTICS_METRICS_API_ENABLED usage to track adoption of the new defaults.
  2. Support tickets: Customers reporting missing metrics on .NET 6/7 (contention_time, ASP.NET Core counters, compacting_gc tag) after upgrading.
  3. Future: Consider defaulting DD_RUNTIME_METRICS_DIAGNOSTICS_METRICS_API_ENABLED=true for all .NET 6+ in a later release once the .NET 6/7 EventCounter gap is documented and communicated.

link04 added 2 commits March 3, 2026 00:30
When DD_RUNTIME_METRICS_ENABLED is not explicitly set and the runtime is
.NET 6+, default to enabled with the System.Diagnostics.Metrics-based
collector. This avoids known EventPipe issues (dotnet/runtime#103480,
dotnet/runtime#111368).

Existing explicit configurations are preserved:
- DD_RUNTIME_METRICS_ENABLED=true keeps EventListener unless
  DD_RUNTIME_METRICS_DIAGNOSTICS_METRICS_API_ENABLED is also set.
- DD_RUNTIME_METRICS_ENABLED=false remains disabled.

Also fix RuntimeMetricsWriter to dispose DiagnosticsMetricsRuntimeMetricsListener
on .NET 6+ (MeterListener is safe to dispose, unlike EventListener).

Made-with: Cursor
@pr-commenter
Copy link

pr-commenter bot commented Mar 3, 2026

Benchmarks

Benchmark execution time: 2026-03-05 17:54:25

Comparing candidate commit febef96 in PR branch maximo/enable-runtime-metrics-default with baseline commit 76f3785 in branch master.

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

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

  • 🟥 execution_time [+79.559ms; +79.754ms] or [+64.977%; +65.136%]

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

  • 🟩 execution_time [-17.895ms; -17.715ms] or [-8.245%; -8.162%]

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

  • 🟥 execution_time [+15.409ms; +20.832ms] or [+7.999%; +10.814%]

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

  • 🟩 execution_time [-21.755ms; -16.093ms] or [-10.084%; -7.459%]

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

  • 🟥 execution_time [+22.966ms; +23.713ms] or [+12.804%; +13.220%]

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

  • 🟥 throughput [-1665.932op/s; -758.689op/s] or [-16.012%; -7.292%]
  • 🟩 execution_time [-84.208ms; -69.386ms] or [-45.630%; -37.598%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟩 execution_time [-38.275ms; -33.127ms] or [-16.663%; -14.422%]
  • 🟩 throughput [+167.171op/s; +190.949op/s] or [+17.133%; +19.570%]

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

  • 🟩 execution_time [-14.585ms; -10.582ms] or [-8.595%; -6.236%]
  • 🟩 throughput [+101.394op/s; +141.795op/s] or [+6.720%; +9.398%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472

  • 🟥 execution_time [+89.878µs; +98.562µs] or [+7.907%; +8.671%]
  • 🟥 throughput [-70.283op/s; -64.373op/s] or [-7.988%; -7.317%]

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

  • 🟩 execution_time [-117.340µs; -112.500µs] or [-5.745%; -5.508%]
  • 🟩 throughput [+28.552op/s; +29.828op/s] or [+5.832%; +6.092%]

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

  • 🟩 execution_time [-23.934ms; -14.646ms] or [-23.290%; -14.251%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472

  • 🟩 throughput [+27487.222op/s; +30997.054op/s] or [+6.421%; +7.241%]

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

  • 🟥 execution_time [+17.865ms; +21.897ms] or [+8.976%; +11.002%]

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

dd-trace-dotnet-ci-bot bot commented Mar 4, 2026

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8267) 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.88 ± (73.81 - 74.11) ms76.58 ± (76.69 - 77.05) ms+3.7%✅⬆️
.NET Framework 4.8 - Bailout
duration78.17 ± (78.04 - 78.46) ms81.32 ± (81.21 - 81.66) ms+4.0%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1071.39 ± (1072.30 - 1078.41) ms1095.74 ± (1098.56 - 1105.02) ms+2.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.53 ± (22.49 - 22.56) ms23.06 ± (23.00 - 23.12) ms+2.4%✅⬆️
process.time_to_main_ms84.77 ± (84.59 - 84.95) ms88.08 ± (87.85 - 88.31) ms+3.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.93 - 10.93) MB10.91 ± (10.91 - 10.92) MB-0.2%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.44 ± (22.40 - 22.48) ms22.95 ± (22.90 - 23.00) ms+2.3%✅⬆️
process.time_to_main_ms85.98 ± (85.76 - 86.21) ms89.50 ± (89.27 - 89.73) ms+4.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.95 - 10.96) MB10.94 ± (10.93 - 10.94) MB-0.2%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms257.49 ± (254.12 - 260.87) ms228.26 ± (225.32 - 231.20) ms-11.4%
process.time_to_main_ms487.19 ± (486.44 - 487.95) ms505.77 ± (504.99 - 506.54) ms+3.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.63 ± (47.61 - 47.65) MB47.61 ± (47.59 - 47.63) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.1%
.NET 6 - Baseline
process.internal_duration_ms21.36 ± (21.32 - 21.40) ms22.12 ± (22.07 - 22.17) ms+3.6%✅⬆️
process.time_to_main_ms74.49 ± (74.31 - 74.67) ms78.21 ± (78.03 - 78.39) ms+5.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.64 ± (10.63 - 10.64) MB10.63 ± (10.62 - 10.63) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.37 ± (21.33 - 21.41) ms22.04 ± (21.97 - 22.10) ms+3.1%✅⬆️
process.time_to_main_ms75.57 ± (75.40 - 75.74) ms79.54 ± (79.33 - 79.75) ms+5.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.74 ± (10.73 - 10.74) MB10.73 ± (10.73 - 10.74) MB-0.0%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms254.75 ± (251.66 - 257.85) ms228.63 ± (224.18 - 233.07) ms-10.3%
process.time_to_main_ms468.91 ± (468.26 - 469.56) ms507.82 ± (506.98 - 508.67) ms+8.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.35 ± (48.32 - 48.37) MB48.82 ± (48.80 - 48.84) MB+1.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)29 ± (29 - 29)+3.8%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.54 ± (19.51 - 19.58) ms20.26 ± (20.21 - 20.31) ms+3.7%✅⬆️
process.time_to_main_ms72.94 ± (72.77 - 73.10) ms76.24 ± (76.06 - 76.42) ms+4.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.70 ± (7.69 - 7.70) MB7.65 ± (7.65 - 7.66) MB-0.5%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.69 ± (19.65 - 19.74) ms20.27 ± (20.22 - 20.33) ms+2.9%✅⬆️
process.time_to_main_ms74.56 ± (74.38 - 74.74) ms77.96 ± (77.82 - 78.09) ms+4.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.75 ± (7.74 - 7.75) MB7.72 ± (7.72 - 7.73) MB-0.3%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms189.81 ± (189.15 - 190.48) ms190.11 ± (188.02 - 192.19) ms+0.2%✅⬆️
process.time_to_main_ms451.38 ± (450.57 - 452.18) ms478.59 ± (477.75 - 479.44) ms+6.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.10 ± (36.07 - 36.14) MB36.20 ± (36.16 - 36.24) MB+0.3%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)28 ± (28 - 28)+3.5%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration194.77 ± (194.69 - 195.57) ms197.33 ± (197.40 - 198.31) ms+1.3%✅⬆️
.NET Framework 4.8 - Bailout
duration197.93 ± (197.81 - 198.55) ms200.34 ± (200.39 - 201.33) ms+1.2%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1151.32 ± (1151.14 - 1158.31) ms1159.58 ± (1160.19 - 1168.60) ms+0.7%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms188.83 ± (188.39 - 189.27) ms190.01 ± (189.55 - 190.47) ms+0.6%✅⬆️
process.time_to_main_ms82.53 ± (82.26 - 82.80) ms82.42 ± (82.20 - 82.64) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.12 ± (16.09 - 16.14) MB16.06 ± (16.04 - 16.08) MB-0.3%
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.1%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms188.14 ± (187.77 - 188.50) ms189.03 ± (188.69 - 189.37) ms+0.5%✅⬆️
process.time_to_main_ms83.28 ± (83.10 - 83.47) ms83.49 ± (83.32 - 83.66) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.16 ± (16.13 - 16.19) MB16.24 ± (16.21 - 16.27) MB+0.5%✅⬆️
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (20 - 21)+0.2%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms436.59 ± (433.78 - 439.40) ms433.20 ± (430.31 - 436.09) ms-0.8%
process.time_to_main_ms478.27 ± (477.58 - 478.96) ms477.78 ± (477.08 - 478.49) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.97 ± (57.84 - 58.09) MB58.15 ± (58.03 - 58.27) MB+0.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms191.39 ± (191.01 - 191.76) ms193.89 ± (193.47 - 194.31) ms+1.3%✅⬆️
process.time_to_main_ms70.48 ± (70.28 - 70.67) ms71.53 ± (71.30 - 71.76) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.20 ± (16.08 - 16.33) MB16.35 ± (16.28 - 16.42) MB+0.9%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.4%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.01 ± (190.65 - 191.36) ms192.46 ± (192.13 - 192.79) ms+0.8%✅⬆️
process.time_to_main_ms71.74 ± (71.60 - 71.88) ms72.37 ± (72.20 - 72.55) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.23 ± (16.09 - 16.36) MB16.22 ± (16.10 - 16.34) MB-0.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.6%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms454.49 ± (452.90 - 456.07) ms430.59 ± (426.41 - 434.76) ms-5.3%
process.time_to_main_ms453.41 ± (452.75 - 454.07) ms478.51 ± (477.68 - 479.34) ms+5.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed57.89 ± (57.79 - 57.99) MB58.76 ± (58.60 - 58.91) MB+1.5%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)31 ± (30 - 31)+3.9%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms191.38 ± (190.96 - 191.80) ms192.28 ± (191.90 - 192.66) ms+0.5%✅⬆️
process.time_to_main_ms70.52 ± (70.33 - 70.71) ms70.96 ± (70.73 - 71.19) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.78 ± (11.75 - 11.80) MB11.73 ± (11.71 - 11.75) MB-0.4%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.5%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms190.29 ± (189.91 - 190.67) ms191.40 ± (190.92 - 191.88) ms+0.6%✅⬆️
process.time_to_main_ms71.40 ± (71.26 - 71.54) ms71.77 ± (71.59 - 71.95) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.84 ± (11.79 - 11.88) MB11.81 ± (11.78 - 11.85) MB-0.2%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.5%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms367.69 ± (366.14 - 369.23) ms367.55 ± (366.08 - 369.02) ms-0.0%
process.time_to_main_ms434.24 ± (433.59 - 434.90) ms454.92 ± (454.12 - 455.72) ms+4.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.78 ± (47.75 - 47.82) MB47.84 ± (47.81 - 47.87) MB+0.1%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)30 ± (30 - 30)+3.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 (8267) - mean (77ms)  : 74, 79
    master - mean (74ms)  : 72, 76

    section Bailout
    This PR (8267) - mean (81ms)  : 79, 84
    master - mean (78ms)  : 76, 80

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (1,102ms)  : 1054, 1149
    master - mean (1,075ms)  : 1032, 1119

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 (8267) - mean (118ms)  : 115, 122
    master - mean (114ms)  : 110, 118

    section Bailout
    This PR (8267) - mean (119ms)  : 117, 122
    master - mean (115ms)  : 113, 118

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (773ms)  : 724, 822
    master - mean (784ms)  : 738, 830

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

    section Bailout
    This PR (8267) - mean (108ms)  : 106, 111
    master - mean (104ms)  : 101, 106

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (777ms)  : 701, 853
    master - mean (762ms)  : 707, 818

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

    section Bailout
    This PR (8267) - mean (106ms)  : 104, 109
    master - mean (102ms)  : 100, 104

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (710ms)  : 667, 752
    master - mean (680ms)  : 653, 707

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 (8267) - mean (198ms)  : 192, 204
    master - mean (195ms)  : 191, 199

    section Bailout
    This PR (8267) - mean (201ms)  : 196, 206
    master - mean (198ms)  : 195, 202

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (1,164ms)  : 1104, 1225
    master - mean (1,155ms)  : 1103, 1207

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 (8267) - mean (282ms)  : 271, 293
    master - mean (280ms)  : 275, 285

    section Bailout
    This PR (8267) - mean (281ms)  : 277, 285
    master - mean (280ms)  : 275, 285

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (940ms)  : 887, 992
    master - mean (948ms)  : 904, 992

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8267) - mean (274ms)  : 268, 280
    master - mean (271ms)  : 265, 276

    section Bailout
    This PR (8267) - mean (273ms)  : 268, 277
    master - mean (271ms)  : 267, 276

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (940ms)  : 863, 1017
    master - mean (942ms)  : 908, 976

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8267) - mean (273ms)  : 267, 280
    master - mean (272ms)  : 266, 278

    section Bailout
    This PR (8267) - mean (273ms)  : 266, 279
    master - mean (271ms)  : 267, 276

    section CallTarget+Inlining+NGEN
    This PR (8267) - mean (852ms)  : 816, 888
    master - mean (834ms)  : 812, 856

Loading

@andrewlock andrewlock added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Mar 4, 2026
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor suggestions on wording and cleanup

@link04 link04 marked this pull request as ready for review March 5, 2026 17:12
@link04 link04 requested review from a team as code owners March 5, 2026 17:12
Copy link

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

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

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

}

#if NET6_0_OR_GREATER
RuntimeMetricsEnabled = runtimeMetricsEnabledResult.WithDefault(true);

Choose a reason for hiding this comment

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

P2 Badge Honor OTEL_METRICS_EXPORTER when defaulting runtime metrics

This new default unconditionally enables runtime metrics on .NET 6+ whenever DD_RUNTIME_METRICS_ENABLED is unset, which means OTEL_METRICS_EXPORTER=none no longer disables runtime metrics in that common “OTel-only” configuration. Because OTEL_METRICS_EXPORTER is still parsed above for overlap/validation, users who previously relied on none to suppress metric emission will now unexpectedly start RuntimeMetricsWriter and emit DogStatsD runtime metrics.

Useful? React with 👍 / 👎.

// to avoid EventPipe crash/leak issues (dotnet/runtime#103480, dotnet/runtime#111368).
// Explicit DD_RUNTIME_METRICS_ENABLED=true users on .NET 6/7 keep EventListener
// to preserve ASP.NET Core EventCounter metrics not available via Diagnostics on < .NET 8.
var diagnosticsDefault = !runtimeMetricsEnabledResult.ConfigurationResult.IsPresent || FrameworkDescription.Instance.RuntimeVersion.Major >= 8;

Choose a reason for hiding this comment

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

P2 Badge Treat invalid DD_RUNTIME_METRICS_ENABLED as unset here

The diagnostics-listener default is keyed only on IsPresent, not validity, so on .NET 6/7 an invalid DD_RUNTIME_METRICS_ENABLED value (e.g., typo) falls back to RuntimeMetricsEnabled=true but computes diagnosticsDefault=false here. That pushes the process onto the RuntimeEventListener path instead of Diagnostics, reintroducing the EventPipe crash/leak risk this change is trying to avoid for defaulted configurations.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos area:runtime-metrics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants