Skip to content

[Runtime Metrics] Support for OTLP Runtime Metrics#8457

Merged
link04 merged 27 commits into
masterfrom
maximo/otlp-runtime-metrics
May 6, 2026
Merged

[Runtime Metrics] Support for OTLP Runtime Metrics#8457
link04 merged 27 commits into
masterfrom
maximo/otlp-runtime-metrics

Conversation

@link04

@link04 link04 commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Add support for exporting .NET runtime metrics via OTLP, using OpenTelemetry semantic convention names. When both DD_RUNTIME_METRICS_ENABLED=true and DD_METRICS_OTEL_ENABLED=true, runtime metrics (System.Runtime) are collected through the existing OTLP metrics pipeline instead of DogStatsD.

Related One Pager: Sending Runtime Metrics via OTLP from dd-trace-*

Reason for change

Enables runtime visibility for users on OTLP-native pipelines or without a local Datadog Agent. Aligns .NET runtime metric names with OTel semantic conventions (dotnet.gc.collections, dotnet.process.cpu.time, etc.).

Implementation details

  • TracerManagerFactory: Disables the StatsD RuntimeMetricsWriter when OTLP runtime metrics are active to prevent duplicate reporting.
  • MetricReaderHandler: Force-enables the System.Runtime meter when OtlpRuntimeMetricsEnabled is true, even if not listed in DD_METRICS_OTEL_METER_NAMES.
  • RuntimeMetricsPolyfill (new): Provides the .NET 9 native System.Runtime instrument set on .NET 6–8 hosts. Names, units, descriptions, and tag keys mirror dotnet/runtimev9.0.0.
  • MeterObservableUpDownCounterReflection (new): Resolves Meter.CreateObservableUpDownCounter<T> at runtime so .NET 7/8 hosts (with System.Diagnostics.DiagnosticSource ≥ 7.0 via roll-forward) emit ObservableUpDownCounter for the 7 point-in-time metrics that match native .NET 9. .NET 6 hosts without DiagnosticSource ≥ 7 fall back to ObservableGauge.
  • Datadog.Trace.Trimming.xml: Preserves the System.Diagnostics.Metrics types the polyfill creates (Counter1, ObservableCounter1, ObservableGauge1, ObservableUpDownCounter1) so they survive aggressive trimming/AOT in customer apps.
  • MetricsRuntime: Starts the polyfill on .NET < 9 with thread-safe initialization.
  • MetricPoint: Detects counter resets on ObservableCounter (treats negative deltas as resets and reports the current value as the delta).

Test coverage

  • OpenTelemetrySdkTests.SubmitsOtlpRuntimeMetrics (new): end-to-end integration test verifying the OTLP runtime metrics payload via a Verify snapshot. A single snapshot covers all TFMs because the test sample transitively references OpenTelemetry 1.13.x → System.Diagnostics.DiagnosticSource 9.0, so the polyfill produces identical wire output on .NET 6/7/8 (and .NET 9+ uses native runtime metrics with the same wire format). Also asserts that StatsD is not emitted when OTLP runtime metrics are active.
  • TracerSettingsTests.OpenTelemetryMetricsEnabled: parameterized unit test confirming the DD_TRACE_OPEN_TELEMETRY_METRICS_ENABLED (or whatever the actual config key name resolves to) boolean parses correctly with default false.
  • Added DD_RUNTIME_METRICS_ENABLED=false to existing SubmitsOtlpMetrics test to prevent runtime metrics from interfering with custom meter assertions.

Verification of .NET 6 in-box behavior (out-of-band)

MeterObservableUpDownCounterReflection.TryRegister was verified directly against each in-box System.Diagnostics.DiagnosticSource (no OTel package installed), since the integration test masks the .NET 6 in-box scenario by transitively pulling in DiagnosticSource 9.0:

TFM DiagnosticSource CreateObservableUpDownCounter overloads TryRegister returns
net6.0 (6.0.36) 6.0.0 0 false → omit branch
net7.0 (7.0.20) 7.0.0 3 true → UpDownCounter
net8.0 (8.0.8) 8.0.0 6 true → UpDownCounter
net9.0 (9.0.9) 9.0.0 6 true → UpDownCounter
The 4-param Length == 4 pin in FindOverload correctly disambiguates on .NET 8/9 where 5-param overloads (with tags) also exist.

Other details

  • Built against system tests PR (system-tests repo) , added need DD_RUNTIME_METRICS_ENABLED=false added to their DEFAULT_ENVVARS to avoid unexpected runtime metrics in OTel metric assertions and created new test based on language expectations.

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Apr 14, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8457) 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
duration71.92 ± (71.89 - 72.22) ms72.91 ± (73.01 - 73.50) ms+1.4%✅⬆️
.NET Framework 4.8 - Bailout
duration77.00 ± (76.77 - 77.12) ms76.80 ± (76.68 - 77.06) ms-0.3%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1078.30 ± (1077.76 - 1084.71) ms1081.34 ± (1082.16 - 1089.54) ms+0.3%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.44 ± (22.40 - 22.48) ms22.46 ± (22.42 - 22.51) ms+0.1%✅⬆️
process.time_to_main_ms84.19 ± (83.99 - 84.38) ms84.78 ± (84.52 - 85.04) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.90 ± (10.90 - 10.91) MB10.91 ± (10.91 - 10.91) MB+0.1%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.80 ± (22.75 - 22.86) ms22.28 ± (22.25 - 22.31) ms-2.3%
process.time_to_main_ms88.84 ± (88.51 - 89.18) ms85.91 ± (85.71 - 86.11) ms-3.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.94) MB10.93 ± (10.93 - 10.94) MB-0.0%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms213.32 ± (212.54 - 214.11) ms214.23 ± (213.27 - 215.20) ms+0.4%✅⬆️
process.time_to_main_ms530.15 ± (528.80 - 531.51) ms534.31 ± (532.73 - 535.90) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.09 ± (48.07 - 48.11) MB48.00 ± (47.97 - 48.03) MB-0.2%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.61 ± (21.55 - 21.67) ms21.37 ± (21.32 - 21.43) ms-1.1%
process.time_to_main_ms75.76 ± (75.45 - 76.06) ms74.44 ± (74.14 - 74.73) ms-1.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.62) MB10.64 ± (10.63 - 10.64) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.38 ± (21.32 - 21.43) ms21.46 ± (21.40 - 21.52) ms+0.4%✅⬆️
process.time_to_main_ms76.19 ± (75.93 - 76.45) ms77.10 ± (76.82 - 77.39) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.72 ± (10.72 - 10.72) MB10.76 ± (10.76 - 10.76) MB+0.4%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms381.15 ± (378.95 - 383.36) ms379.98 ± (377.90 - 382.06) ms-0.3%
process.time_to_main_ms532.04 ± (530.81 - 533.26) ms531.03 ± (529.56 - 532.51) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.31 ± (49.28 - 49.34) MB49.54 ± (49.52 - 49.57) MB+0.5%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.1%
.NET 8 - Baseline
process.internal_duration_ms19.32 ± (19.28 - 19.36) ms19.50 ± (19.46 - 19.53) ms+0.9%✅⬆️
process.time_to_main_ms72.57 ± (72.40 - 72.74) ms72.88 ± (72.73 - 73.04) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.66 ± (7.66 - 7.67) MB7.66 ± (7.65 - 7.66) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.74 ± (19.68 - 19.79) ms19.64 ± (19.59 - 19.68) ms-0.5%
process.time_to_main_ms76.19 ± (75.89 - 76.48) ms74.51 ± (74.35 - 74.68) ms-2.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.72 - 7.73) MB7.70 ± (7.70 - 7.71) MB-0.3%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms301.27 ± (299.10 - 303.45) ms302.93 ± (300.68 - 305.19) ms+0.6%✅⬆️
process.time_to_main_ms492.89 ± (491.68 - 494.10) ms496.29 ± (495.05 - 497.52) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.60 ± (36.57 - 36.63) MB36.59 ± (36.57 - 36.62) MB-0.0%
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
duration208.24 ± (208.31 - 210.00) ms204.55 ± (205.15 - 206.85) ms-1.8%
.NET Framework 4.8 - Bailout
duration212.88 ± (212.85 - 214.53) ms209.92 ± (210.58 - 212.31) ms-1.4%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1250.98 ± (1250.29 - 1260.27) ms1228.85 ± (1227.88 - 1234.77) ms-1.8%
.NET Core 3.1 - Baseline
process.internal_duration_ms199.45 ± (198.70 - 200.19) ms203.64 ± (202.74 - 204.54) ms+2.1%✅⬆️
process.time_to_main_ms86.87 ± (86.49 - 87.25) ms88.14 ± (87.72 - 88.56) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed15.96 ± (15.94 - 15.97) MB15.93 ± (15.91 - 15.94) MB-0.2%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.9%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms199.06 ± (198.34 - 199.77) ms202.26 ± (201.47 - 203.05) ms+1.6%✅⬆️
process.time_to_main_ms88.12 ± (87.77 - 88.46) ms89.97 ± (89.54 - 90.39) ms+2.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.00 ± (15.98 - 16.01) MB15.97 ± (15.96 - 15.99) MB-0.1%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.1%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms397.37 ± (395.94 - 398.81) ms395.90 ± (394.32 - 397.47) ms-0.4%
process.time_to_main_ms547.01 ± (545.22 - 548.81) ms555.21 ± (553.83 - 556.59) ms+1.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.49 ± (58.38 - 58.61) MB58.45 ± (58.30 - 58.60) MB-0.1%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.1%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms209.41 ± (208.40 - 210.42) ms209.41 ± (208.48 - 210.35) ms+0.0%✅⬆️
process.time_to_main_ms77.09 ± (76.73 - 77.45) ms77.70 ± (77.24 - 78.17) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.18 ± (16.17 - 16.20) MB16.19 ± (16.17 - 16.21) MB+0.0%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 20)20 ± (19 - 20)+0.0%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms209.47 ± (208.31 - 210.63) ms209.70 ± (208.72 - 210.67) ms+0.1%✅⬆️
process.time_to_main_ms78.33 ± (77.94 - 78.73) ms78.88 ± (78.46 - 79.30) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.17 ± (16.15 - 16.19) MB16.25 ± (16.23 - 16.27) MB+0.5%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 21)+0.6%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms593.66 ± (589.11 - 598.21) ms594.61 ± (591.93 - 597.29) ms+0.2%✅⬆️
process.time_to_main_ms559.52 ± (557.21 - 561.84) ms550.54 ± (548.92 - 552.16) ms-1.6%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed60.71 ± (60.61 - 60.81) MB61.06 ± (60.97 - 61.16) MB+0.6%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)-0.1%
.NET 8 - Baseline
process.internal_duration_ms213.86 ± (212.44 - 215.27) ms206.68 ± (205.69 - 207.66) ms-3.4%
process.time_to_main_ms78.59 ± (78.08 - 79.10) ms76.23 ± (75.85 - 76.61) ms-3.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.41 ± (11.39 - 11.44) MB11.57 ± (11.56 - 11.59) MB+1.4%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.2%
.NET 8 - Bailout
process.internal_duration_ms213.09 ± (211.66 - 214.52) ms205.89 ± (205.07 - 206.72) ms-3.4%
process.time_to_main_ms79.87 ± (79.38 - 80.35) ms77.12 ± (76.78 - 77.47) ms-3.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.49 ± (11.47 - 11.51) MB11.63 ± (11.61 - 11.64) MB+1.2%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-1.2%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms558.52 ± (550.31 - 566.73) ms523.43 ± (518.29 - 528.58) ms-6.3%
process.time_to_main_ms521.88 ± (519.17 - 524.59) ms502.19 ± (500.75 - 503.63) ms-3.8%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.68 ± (50.58 - 50.77) MB50.41 ± (50.36 - 50.46) MB-0.5%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.3%
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 (8457) - mean (73ms)  : 69, 77
    master - mean (72ms)  : 70, 75

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

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (1,086ms)  : 1033, 1139
    master - mean (1,081ms)  : 1031, 1132

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 (8457) - mean (114ms)  : 108, 121
    master - mean (113ms)  : 109, 118

    section Bailout
    This PR (8457) - mean (115ms)  : 111, 119
    master - mean (119ms)  : 112, 126

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (785ms)  : 763, 808
    master - mean (783ms)  : 749, 816

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8457) - mean (103ms)  : 96, 109
    master - mean (104ms)  : 98, 110

    section Bailout
    This PR (8457) - mean (105ms)  : 100, 110
    master - mean (104ms)  : 99, 110

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (942ms)  : 902, 983
    master - mean (942ms)  : 905, 980

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

    section Bailout
    This PR (8457) - mean (102ms)  : 99, 105
    master - mean (104ms)  : 98, 111

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (832ms)  : 794, 870
    master - mean (824ms)  : 788, 860

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 (8457) - mean (206ms)  : 194, 218
    master - mean (209ms)  : 197, 221

    section Bailout
    This PR (8457) - mean (211ms)  : 199, 224
    master - mean (214ms)  : 202, 226

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (1,231ms)  : 1182, 1280
    master - mean (1,255ms)  : 1179, 1332

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 (8457) - mean (303ms)  : 284, 321
    master - mean (298ms)  : 277, 319

    section Bailout
    This PR (8457) - mean (305ms)  : 282, 328
    master - mean (298ms)  : 281, 315

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (996ms)  : 967, 1025
    master - mean (983ms)  : 944, 1022

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8457) - mean (298ms)  : 279, 317
    master - mean (299ms)  : 273, 325

    section Bailout
    This PR (8457) - mean (301ms)  : 276, 326
    master - mean (300ms)  : 274, 326

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (1,177ms)  : 1130, 1223
    master - mean (1,193ms)  : 1123, 1263

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8457) - mean (296ms)  : 272, 320
    master - mean (309ms)  : 271, 347

    section Bailout
    This PR (8457) - mean (295ms)  : 278, 312
    master - mean (312ms)  : 268, 356

    section CallTarget+Inlining+NGEN
    This PR (8457) - mean (1,062ms)  : 987, 1136
    master - mean (1,121ms)  : 998, 1244

Loading

@pr-commenter

pr-commenter Bot commented Apr 14, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-05 21:50:33

Comparing candidate commit 31c69cd in PR branch maximo/otlp-runtime-metrics with baseline commit 3673951 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 57 known flaky benchmarks, 30 flaky benchmarks without significant changes.

Explanation

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

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

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

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

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

More details about the CI and significant changes

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

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

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

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

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

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

Known flaky benchmarks

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

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

  • 🟩 throughput [+8734.892op/s; +11538.260op/s] or [+7.342%; +9.698%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+318.144ms; +322.761ms] or [+157.874%; +160.166%]
  • 🟥 throughput [-42.653op/s; -39.054op/s] or [-7.674%; -7.027%]

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

  • 🟥 execution_time [+380.111ms; +381.828ms] or [+300.311%; +301.668%]
  • 🟩 throughput [+90.700op/s; +94.649op/s] or [+11.959%; +12.479%]

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

  • 🟥 execution_time [+394.722ms; +397.133ms] or [+349.314%; +351.448%]

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

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.529%; +27.541%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.977%; +9.987%]
  • 🟩 execution_time [-16.090ms; -11.925ms] or [-7.515%; -5.569%]

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

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

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

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.746%; +105.759%]
  • 🟥 throughput [-267539.671op/s; -263780.866op/s] or [-27.317%; -26.933%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.558%; +38.566%]
  • 🟩 execution_time [-25.508ms; -20.147ms] or [-11.376%; -8.985%]
  • 🟥 throughput [-89207.155op/s; -64494.787op/s] or [-9.530%; -6.890%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.292%; +105.304%]
  • 🟥 throughput [-135358.046op/s; -119308.356op/s] or [-19.448%; -17.142%]

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

  • 🟩 throughput [+311393.018op/s; +341581.585op/s] or [+10.383%; +11.390%]

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

  • 🟩 execution_time [-18.270ms; -13.908ms] or [-8.422%; -6.411%]
  • 🟩 throughput [+192593.479op/s; +246444.678op/s] or [+7.645%; +9.782%]

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

  • 🟥 execution_time [+299.309ms; +299.880ms] or [+149.555%; +149.840%]

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

  • 🟥 execution_time [+303.580ms; +307.720ms] or [+153.096%; +155.184%]

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

  • 🟥 execution_time [+299.970ms; +302.355ms] or [+151.102%; +152.303%]

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

  • 🟥 execution_time [+296.529ms; +297.537ms] or [+145.644%; +146.138%]

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

  • 🟥 execution_time [+296.093ms; +299.852ms] or [+144.749%; +146.587%]

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

  • 🟥 execution_time [+301.319ms; +302.367ms] or [+150.599%; +151.122%]

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

  • 🟥 execution_time [+23.563µs; +50.293µs] or [+5.404%; +11.535%]
  • 🟥 throughput [-245.176op/s; -124.959op/s] or [-10.659%; -5.433%]

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

  • 🟥 execution_time [+26.685µs; +50.271µs] or [+8.519%; +16.049%]
  • 🟥 throughput [-463.413op/s; -264.942op/s] or [-14.446%; -8.259%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.741ms; +300.415ms] or [+149.602%; +149.938%]

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

  • unstable execution_time [+387.331ms; +411.124ms] or [+420.851%; +446.703%]
  • 🟩 throughput [+1180.315op/s; +1314.657op/s] or [+9.699%; +10.803%]

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

  • unstable execution_time [+303.525ms; +342.034ms] or [+230.463%; +259.703%]
  • 🟩 throughput [+692.099op/s; +892.416op/s] or [+6.700%; +8.639%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+343.008ms; +384.794ms] or [+157.712%; +176.924%]
  • 🟥 throughput [-573.744op/s; -534.511op/s] or [-51.987%; -48.432%]

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

  • unstable execution_time [+206.743ms; +339.977ms] or [+88.105%; +144.884%]
  • 🟥 throughput [-668.523op/s; -585.091op/s] or [-44.591%; -39.026%]

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

  • 🟥 execution_time [+352.310ms; +363.973ms] or [+210.722%; +217.698%]
  • 🟥 throughput [-417.063op/s; -380.062op/s] or [-29.039%; -26.463%]

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

  • unstable throughput [+5.795op/s; +71.001op/s] or [+1.082%; +13.253%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+303.615ms; +305.257ms] or [+152.895%; +153.722%]

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

  • 🟥 execution_time [+300.677ms; +301.894ms] or [+150.670%; +151.279%]

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

  • 🟥 execution_time [+301.881ms; +305.054ms] or [+151.652%; +153.246%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+301.469ms; +303.001ms] or [+151.388%; +152.157%]

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

  • 🟥 execution_time [+298.458ms; +300.402ms] or [+147.574%; +148.535%]

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

  • 🟥 execution_time [+303.720ms; +307.205ms] or [+153.939%; +155.705%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+300.913ms; +302.283ms] or [+151.031%; +151.719%]

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

  • 🟥 execution_time [+301.008ms; +303.386ms] or [+150.025%; +151.210%]
  • 🟩 throughput [+37518.762op/s; +44717.572op/s] or [+7.450%; +8.879%]

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

  • 🟥 execution_time [+301.244ms; +304.127ms] or [+149.866%; +151.300%]

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

  • 🟩 execution_time [-16.094ms; -12.438ms] or [-7.484%; -5.784%]
  • 🟩 throughput [+25073.802op/s; +31968.890op/s] or [+6.878%; +8.770%]

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

  • unstable execution_time [+5.086µs; +46.071µs] or [+1.256%; +11.380%]

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

  • 🟩 allocated_mem [-19.077KB; -19.057KB] or [-6.959%; -6.951%]
  • unstable execution_time [+4.333µs; +74.744µs] or [+0.856%; +14.773%]
  • unstable throughput [-197.733op/s; +6.319op/s] or [-9.867%; +0.315%]

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

  • 🟥 execution_time [+10.121µs; +14.274µs] or [+23.923%; +33.739%]
  • 🟥 throughput [-6101.976op/s; -4356.683op/s] or [-25.687%; -18.340%]

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

  • unstable execution_time [-13.300µs; -5.902µs] or [-20.634%; -9.157%]
  • 🟩 throughput [+1526.203op/s; +3080.465op/s] or [+9.364%; +18.900%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.809ms; +304.215ms] or [+153.056%; +153.767%]

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

  • 🟥 execution_time [+302.417ms; +304.884ms] or [+153.929%; +155.185%]

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

  • 🟥 execution_time [+299.500ms; +301.922ms] or [+149.937%; +151.149%]

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

  • 🟩 throughput [+37768.214op/s; +40751.686op/s] or [+7.149%; +7.713%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.183ms; +302.115ms] or [+149.614%; +150.577%]

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

  • 🟥 execution_time [+301.354ms; +303.412ms] or [+151.326%; +152.359%]

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

  • 🟥 execution_time [+303.425ms; +305.651ms] or [+153.878%; +155.007%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.742ms; +300.454ms] or [+149.513%; +149.868%]
  • 🟩 throughput [+61238327.681op/s; +61486253.627op/s] or [+44.598%; +44.778%]

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

  • 🟥 execution_time [+420.754ms; +424.495ms] or [+523.283%; +527.935%]
  • 🟩 throughput [+1080.705op/s; +1252.897op/s] or [+8.354%; +9.686%]

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

  • 🟥 execution_time [+299.356ms; +300.265ms] or [+149.312%; +149.765%]

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

  • 🟩 throughput [+95563.154op/s; +107714.865op/s] or [+8.922%; +10.057%]

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

  • 🟩 throughput [+48750.793op/s; +68153.484op/s] or [+5.643%; +7.889%]

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

  • 🟩 throughput [+105231.894op/s; +134669.894op/s] or [+8.145%; +10.424%]

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

  • 🟩 throughput [+87284.317op/s; +94839.432op/s] or [+8.669%; +9.419%]

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

  • 🟩 throughput [+59457.130op/s; +63823.425op/s] or [+10.796%; +11.589%]

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

  • 🟩 throughput [+66786.103op/s; +87463.915op/s] or [+7.462%; +9.772%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • 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.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@link04 link04 added docker_image_artifacts Use to label PRs for which you would need a Docker Image created for. area:opentelemetry OpenTelemetry support area:runtime-metrics labels Apr 15, 2026
@link04 link04 marked this pull request as ready for review April 22, 2026 15:36
@link04 link04 requested review from a team as code owners April 22, 2026 15:36

@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: 1b582a23e4

ℹ️ 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/OpenTelemetry/Metrics/MetricsRuntime.cs
Comment thread tracer/src/Datadog.Trace/Configuration/TracerSettings.cs Outdated

@bouwkast bouwkast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Haven't gone through everything yet but will pick it up again tomorrow

Comment thread tracer/src/Datadog.Trace/Configuration/TracerSettings.cs Outdated
Comment thread tracer/src/Datadog.Trace/OpenTelemetry/Metrics/MetricsRuntime.cs
Comment thread tracer/src/Datadog.Trace/OpenTelemetry/Metrics/MetricsRuntime.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 in general, some relatively minor suggestions and questions in general.

While reviewing this I had a realization - OpenTelemetry themselves add polyfills for many of these... e.g.

https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/5aa6d868/src/OpenTelemetry.Instrumentation.Runtime/RuntimeMetrics.cs#L105C40-L107

What happens if you have the same pollyfilled values, with the same meter and instrument names? 🤔 Do we need to handle that explicitly, or does the runtime handled it? And have you compared our implementation to theirs?

Comment thread tracer/src/Datadog.Trace/Configuration/TracerSettings.cs Outdated
// indicates a counter reset (e.g. process restart). Report currentValue
// as the delta, as if the previous cumulative was 0.
// ObservableUpDownCounter is non-monotonic so negative deltas are expected.
if (delta < 0 && InstrumentType is InstrumentType.ObservableCounter)

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.

Just a thought, and not strictly related to this PR: Do we need a similar guard somewhere for negative values in InstrumentTrype.Counter too? 🤔 I don't think it needs to be right here (because this method is all about observable counters), but I believe we could have the same wrapping case to handle.

I think we may also need to handle this in our statsd case too - I'll look into it!

// ObservableUpDownCounter is non-monotonic so negative deltas are expected.
if (delta < 0 && InstrumentType is InstrumentType.ObservableCounter)
{
delta = _runningDoubleValue;

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.

Had to work this one through to convince myself it's correct, so included here so others don't need to 😅

In an overflow scenario - given that you would have (for example)

  • _runningDoubleValue is small (due to overflow) e.g. 10
  • _lastObservedCumulative is huge e.g. 1,000,000,000,000

Then

  • _delta = _runningDoubleValue - previousCumulative ~-1,000,000,000,000

So we hit this branch and set

  • _delta = _runningDoubleValue = ~10

so LGTM!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aay thank you for adding this investigation here!

Comment thread tracer/src/Datadog.Trace/OpenTelemetry/Metrics/MetricsRuntime.cs
Comment thread tracer/test/Datadog.Trace.Tests/RuntimeMetrics/RuntimeMetricsMeterTests.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tests/RuntimeMetrics/RuntimeMetricsMeterTests.cs Outdated
Comment thread tracer/test/Datadog.Trace.Tests/RuntimeMetrics/RuntimeMetricsMeterTests.cs Outdated
Comment thread tracer/src/Datadog.Trace/RuntimeMetrics/RuntimeMetricsPolyfill.cs Outdated
Comment thread tracer/src/Datadog.Trace/RuntimeMetrics/RuntimeMetricsPolyfill.cs Outdated

@zacharycmontoya zacharycmontoya 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.

I have one confusion that needs clarifying, otherwise this looks good and the polyfill to implement the metrics for pre-.NET 9 is nice 👌🏼

@bouwkast bouwkast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for the delay!

Just one comment from me but I think everything else looks good and has been covered by others 👍

Comment thread tracer/src/Datadog.Trace/Configuration/TracerSettings.cs

@zacharycmontoya zacharycmontoya 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.

LGTM, thanks for all the updates!

@link04 link04 merged commit d94a684 into master May 6, 2026
141 checks passed
@link04 link04 deleted the maximo/otlp-runtime-metrics branch May 6, 2026 14:25
@github-actions github-actions Bot added this to the vNext-v3 milestone May 6, 2026
andrewlock added a commit that referenced this pull request May 12, 2026
…8609)

## Summary of changes

Adds explicit handling of `OutOfMemoryException` to runtime metrics
polyfill added in #8457

## Reason for change

Doing anything when you have an `OutOfMemoryException` is liable to
cause allocation, and trigger a full-on crash. We have guards for this
today in `RuntimeMetricsWriter`, so we should probably do something
similar with our pollyfill too.

## Implementation details

- Add an explicit guard to the handler for `OutOfMemoryException`
- Use try-finally to ensure we definitely reset
`_handlingFirstChanceException`

## Test coverage

Not easy to test in practice, and relatively self explanatory so meh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:opentelemetry OpenTelemetry support area:runtime-metrics docker_image_artifacts Use to label PRs for which you would need a Docker Image created for.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants