Skip to content

[tracing] add support for DiagnosticSource (and Quartz) in .NET Framework#7687

Merged
chojomok merged 54 commits into
masterfrom
mohammad/diagnosticobserver_netframework_support
Mar 23, 2026
Merged

[tracing] add support for DiagnosticSource (and Quartz) in .NET Framework#7687
chojomok merged 54 commits into
masterfrom
mohammad/diagnosticobserver_netframework_support

Conversation

@chojomok

@chojomok chojomok commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

Summary of changes

Adds .NET Framework support for the DiagnosticManager / DiagnosticObserver infrastructure and uses it to enhance Quartz span metadata on both Framework and non-Framework
targets.

Reason for change

The DiagnosticObserver class was previously gated behind #if !NETFRAMEWORK, limiting tracing integrations that depend on it to modern .NET only. Quartz is the first

Implementation details

DiagnosticManager — Framework support

On !NETFRAMEWORK, the existing path is unchanged: DiagnosticListener.AllListeners.Subscribe(new DiagnosticListenerObserver(this)).

On NETFRAMEWORK, DiagnosticListener isn't available at compile time (it ships as a NuGet package, not part of the BCL). Two problems had to be solved:

  1. Accessing the static AllListeners property — solved with reflection to locate the DiagnosticListener type and read its static property at runtime.
  2. Generic invarianceAllListeners.Subscribe expects IObserver<DiagnosticListener> (the real type). A new FrameworkDiagnosticListenerObserver reverse duck type
    ([DuckReverseMethod] + .DuckImplement()) generates a proxy at runtime that satisfies the exact generic interface, forwarding each OnNext call back to DiagnosticManager.

DiagnosticObserver — duck typed DiagnosticListener

SubscribeIfMatch was updated to accept IDiagnosticListener (a new duck type interface) instead of the concrete DiagnosticListener, removing the compile-time dependency on
the type across the whole observer hierarchy.

Quartz

  • QuartzDiagnosticObserver is registered in StartDiagnosticManager unconditionally (both platforms).
  • QuartzCommon was enhanced to set the component: quartz tag and activity kind on the pre-IActivity5 fallback path (< .NET 5), bringing its span metadata in line with
    newer runtimes.

Cleanup

  • Consolidated the duplicate #if !NETFRAMEWORK / #else split of StartDiagnosticManager in Instrumentation.cs into a single method with an inline directive.
  • Removed an unnecessary #if NETFRAMEWORK block in ActivityListener.cs that duplicated CreateDiagnosticSourceListenerInstance — the IL emit approach works on Framework
    too.

Test coverage

  • New snapshot QuartzTestsV3NETFRAMEWORK.verified.txt covering Quartz on .NET Framework.
  • Updated QuartzTestsV3NETCOREAPP3X.verified.txt to include the component: quartz tag now set on the pre-IActivity5 path.

Other details

@chojomok
chojomok requested review from a team as code owners October 21, 2025 15:57
@datadog-datadog-prod-us1

This comment has been minimized.

@chojomok chojomok changed the title mohammad/diagnosticobserver netframework support [tracing] add support for Quartz integration for framework Oct 21, 2025
@chojomok
chojomok marked this pull request as draft October 21, 2025 16:00
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Oct 21, 2025

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7687) and master.

⚠️ Potential regressions detected

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.99 ± (193.05 - 193.92) ms220.29 ± (219.95 - 222.25) ms+14.1%❌⬆️
.NET Framework 4.8 - Bailout
duration198.21 ± (198.20 - 199.08) ms217.58 ± (217.59 - 218.71) ms+9.8%❌⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1143.86 ± (1146.37 - 1153.34) ms1225.11 ± (1225.46 - 1233.47) ms+7.1%❌⬆️
Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration69.17 ± (69.07 - 69.36) ms68.70 ± (68.76 - 69.03) ms-0.7%
.NET Framework 4.8 - Bailout
duration73.41 ± (73.29 - 73.59) ms72.28 ± (72.21 - 72.43) ms-1.5%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1038.40 ± (1048.38 - 1059.66) ms1038.60 ± (1048.32 - 1058.96) ms+0.0%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms21.77 ± (21.74 - 21.80) ms21.78 ± (21.75 - 21.81) ms+0.0%✅⬆️
process.time_to_main_ms79.33 ± (79.17 - 79.49) ms79.54 ± (79.37 - 79.71) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.90 ± (10.90 - 10.91) MB10.92 ± (10.91 - 10.92) MB+0.1%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms21.72 ± (21.70 - 21.75) ms21.74 ± (21.71 - 21.76) ms+0.1%✅⬆️
process.time_to_main_ms80.56 ± (80.42 - 80.70) ms80.58 ± (80.45 - 80.71) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.94 - 10.95) MB10.95 ± (10.94 - 10.95) MB+0.0%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms216.36 ± (215.37 - 217.35) ms218.06 ± (216.76 - 219.36) ms+0.8%✅⬆️
process.time_to_main_ms467.77 ± (467.30 - 468.24) ms516.35 ± (515.29 - 517.42) ms+10.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed47.31 ± (47.29 - 47.34) MB48.19 ± (48.15 - 48.22) MB+1.8%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 6 - Baseline
process.internal_duration_ms20.51 ± (20.49 - 20.54) ms20.61 ± (20.58 - 20.64) ms+0.5%✅⬆️
process.time_to_main_ms68.70 ± (68.57 - 68.84) ms69.33 ± (69.16 - 69.50) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.61) MB10.62 ± (10.62 - 10.63) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.49 ± (20.47 - 20.51) ms20.56 ± (20.53 - 20.59) ms+0.3%✅⬆️
process.time_to_main_ms69.55 ± (69.44 - 69.66) ms70.37 ± (70.24 - 70.51) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.67 ± (10.66 - 10.67) MB10.73 ± (10.73 - 10.74) MB+0.6%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms200.96 ± (198.99 - 202.93) ms206.90 ± (205.54 - 208.27) ms+3.0%✅⬆️
process.time_to_main_ms468.99 ± (468.33 - 469.65) ms516.67 ± (515.42 - 517.92) ms+10.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.96 ± (48.89 - 49.02) MB50.10 ± (50.07 - 50.14) MB+2.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms18.84 ± (18.81 - 18.88) ms18.80 ± (18.78 - 18.83) ms-0.2%
process.time_to_main_ms68.13 ± (67.99 - 68.27) ms68.21 ± (68.09 - 68.33) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.67) MB7.66 ± (7.66 - 7.66) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms18.79 ± (18.76 - 18.82) ms18.80 ± (18.77 - 18.82) ms+0.0%✅⬆️
process.time_to_main_ms69.30 ± (69.18 - 69.43) ms69.50 ± (69.36 - 69.64) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.73 ± (7.73 - 7.74) MB7.75 ± (7.74 - 7.76) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms157.58 ± (156.62 - 158.53) ms153.57 ± (152.81 - 154.33) ms-2.5%
process.time_to_main_ms448.33 ± (447.81 - 448.84) ms475.71 ± (474.83 - 476.60) ms+6.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.54 ± (36.52 - 36.56) MB36.93 ± (36.90 - 36.95) MB+1.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.99 ± (193.05 - 193.92) ms220.29 ± (219.95 - 222.25) ms+14.1%❌⬆️
.NET Framework 4.8 - Bailout
duration198.21 ± (198.20 - 199.08) ms217.58 ± (217.59 - 218.71) ms+9.8%❌⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1143.86 ± (1146.37 - 1153.34) ms1225.11 ± (1225.46 - 1233.47) ms+7.1%❌⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms187.52 ± (187.18 - 187.86) ms208.06 ± (207.46 - 208.65) ms+11.0%✅⬆️
process.time_to_main_ms80.41 ± (80.21 - 80.61) ms89.49 ± (89.25 - 89.73) ms+11.3%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.15 ± (16.12 - 16.17) MB15.92 ± (15.90 - 15.93) MB-1.4%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+1.0%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms186.79 ± (186.49 - 187.08) ms207.82 ± (207.22 - 208.42) ms+11.3%✅⬆️
process.time_to_main_ms81.74 ± (81.61 - 81.87) ms91.11 ± (90.87 - 91.35) ms+11.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.21 ± (16.18 - 16.25) MB16.01 ± (15.99 - 16.03) MB-1.3%
runtime.dotnet.threads.count21 ± (20 - 21)21 ± (21 - 21)+1.5%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms396.34 ± (394.50 - 398.18) ms412.55 ± (411.41 - 413.70) ms+4.1%✅⬆️
process.time_to_main_ms472.64 ± (472.13 - 473.15) ms554.40 ± (553.11 - 555.69) ms+17.3%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.66 ± (57.50 - 57.82) MB59.07 ± (59.03 - 59.11) MB+2.4%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.2%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms192.44 ± (192.01 - 192.87) ms214.08 ± (213.46 - 214.69) ms+11.2%✅⬆️
process.time_to_main_ms69.96 ± (69.78 - 70.14) ms78.06 ± (77.85 - 78.28) ms+11.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.05 ± (15.92 - 16.19) MB16.21 ± (16.19 - 16.22) MB+0.9%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 20)+3.7%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms192.22 ± (191.76 - 192.68) ms212.42 ± (211.88 - 212.96) ms+10.5%✅⬆️
process.time_to_main_ms71.09 ± (70.93 - 71.25) ms79.01 ± (78.82 - 79.21) ms+11.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.05 ± (15.90 - 16.21) MB16.25 ± (16.23 - 16.27) MB+1.2%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (20 - 21)+6.4%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms428.77 ± (427.15 - 430.40) ms442.61 ± (441.01 - 444.20) ms+3.2%✅⬆️
process.time_to_main_ms473.98 ± (473.15 - 474.81) ms563.71 ± (562.52 - 564.90) ms+18.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed60.25 ± (60.16 - 60.35) MB60.85 ± (60.81 - 60.89) MB+1.0%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)31 ± (31 - 31)+1.8%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms190.28 ± (189.90 - 190.67) ms227.38 ± (226.23 - 228.52) ms+19.5%✅⬆️
process.time_to_main_ms69.48 ± (69.29 - 69.66) ms80.14 ± (79.85 - 80.43) ms+15.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.77 ± (11.74 - 11.80) MB11.46 ± (11.45 - 11.48) MB-2.6%
runtime.dotnet.threads.count18 ± (18 - 18)19 ± (19 - 19)+4.5%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms189.20 ± (188.89 - 189.50) ms223.21 ± (222.10 - 224.31) ms+18.0%✅⬆️
process.time_to_main_ms70.42 ± (70.30 - 70.54) ms80.25 ± (79.97 - 80.53) ms+14.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.76 ± (11.69 - 11.83) MB11.51 ± (11.50 - 11.53) MB-2.1%
runtime.dotnet.threads.count19 ± (18 - 19)20 ± (20 - 20)+7.2%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms352.63 ± (351.38 - 353.88) ms465.72 ± (461.51 - 469.94) ms+32.1%✅⬆️
process.time_to_main_ms451.07 ± (450.50 - 451.63) ms525.11 ± (523.86 - 526.37) ms+16.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed48.54 ± (48.51 - 48.57) MB50.74 ± (50.67 - 50.81) MB+4.5%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.7%✅⬆️
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7687) - mean (69ms)  : 67, 71
    master - mean (69ms)  : 67, 71

    section Bailout
    This PR (7687) - mean (72ms)  : 71, 73
    master - mean (73ms)  : 72, 75

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (1,054ms)  : 974, 1133
    master - mean (1,054ms)  : 968, 1140

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 (7687) - mean (107ms)  : 104, 110
    master - mean (107ms)  : 103, 110

    section Bailout
    This PR (7687) - mean (108ms)  : 106, 110
    master - mean (108ms)  : 106, 110

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (773ms)  : crit, 752, 793
    master - mean (722ms)  : 699, 744

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7687) - mean (95ms)  : 93, 97
    master - mean (94ms)  : 91, 98

    section Bailout
    This PR (7687) - mean (96ms)  : 95, 98
    master - mean (95ms)  : 93, 97

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (757ms)  : crit, 740, 774
    master - mean (699ms)  : 648, 749

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7687) - mean (94ms)  : 91, 96
    master - mean (94ms)  : 91, 96

    section Bailout
    This PR (7687) - mean (95ms)  : 93, 97
    master - mean (95ms)  : 93, 97

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (661ms)  : 643, 678
    master - mean (637ms)  : 615, 658

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 (7687) - mean (221ms)  : 204, 238
    master - mean (193ms)  : 189, 198

    section Bailout
    This PR (7687) - mean (218ms)  : crit, 210, 226
    master - mean (199ms)  : 193, 204

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (1,229ms)  : crit, 1170, 1289
    master - mean (1,150ms)  : 1100, 1200

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 (7687) - mean (307ms)  : 296, 318
    master - mean (276ms)  : 272, 281

    section Bailout
    This PR (7687) - mean (308ms)  : crit, 296, 321
    master - mean (277ms)  : 273, 281

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (1,011ms)  : crit, 984, 1039
    master - mean (900ms)  : 865, 936

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7687) - mean (302ms)  : 289, 314
    master - mean (271ms)  : 264, 277

    section Bailout
    This PR (7687) - mean (301ms)  : crit, 291, 311
    master - mean (272ms)  : 266, 277

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (1,048ms)  : crit, 1012, 1084
    master - mean (936ms)  : 912, 960

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7687) - mean (318ms)  : 298, 338
    master - mean (269ms)  : 264, 275

    section Bailout
    This PR (7687) - mean (315ms)  : crit, 295, 334
    master - mean (269ms)  : 265, 273

    section CallTarget+Inlining+NGEN
    This PR (7687) - mean (1,029ms)  : crit, 956, 1102
    master - mean (835ms)  : 804, 866

Loading

@pr-commenter

pr-commenter Bot commented Oct 21, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-03-23 20:48:16

Comparing candidate commit 0c86384 in PR branch mohammad/diagnosticobserver_netframework_support with baseline commit 6f4edac in branch master.

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

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.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+84.662ms; +85.645ms] or [+74.861%; +75.730%]

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

  • 🟥 execution_time [+23.304ms; +28.197ms] or [+11.729%; +14.191%]

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

  • 🟥 execution_time [+18.918ms; +22.798ms] or [+9.331%; +11.244%]
  • 🟩 throughput [+205583.531op/s; +266054.876op/s] or [+7.071%; +9.151%]

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

  • 🟩 execution_time [-24.066ms; -17.752ms] or [-11.138%; -8.216%]

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

  • 🟩 execution_time [-23.636ms; -23.258ms] or [-11.899%; -11.709%]

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

  • 🟩 throughput [+161.109op/s; +335.852op/s] or [+5.379%; +11.212%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+16.639ms; +28.351ms] or [+8.592%; +14.640%]
  • 🟩 throughput [+92.808op/s; +148.837op/s] or [+9.356%; +15.005%]

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

  • 🟩 execution_time [-76.338ms; -73.150ms] or [-35.491%; -34.009%]
  • 🟩 throughput [+241.578op/s; +273.794op/s] or [+18.041%; +20.447%]

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

  • 🟥 execution_time [+58.700µs; +67.300µs] or [+5.712%; +6.548%]
  • 🟥 throughput [-59.855op/s; -52.461op/s] or [-6.151%; -5.391%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟩 throughput [+19012.387op/s; +22151.997op/s] or [+5.173%; +6.027%]

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

  • 🟩 execution_time [-19.521ms; -15.288ms] or [-8.969%; -7.024%]

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

  • 🟥 allocated_mem [+14.582KB; +14.623KB] or [+5.648%; +5.664%]

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

  • 🟩 allocated_mem [-19.810KB; -19.774KB] or [-7.140%; -7.127%]

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

  • 🟩 execution_time [-46.629ms; -40.945ms] or [-23.162%; -20.339%]

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

  • 🟥 throughput [-15762067.511op/s; -14516654.923op/s] or [-6.549%; -6.032%]

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

  • 🟥 throughput [-38175.607op/s; -26126.837op/s] or [-8.482%; -5.805%]

@github-actions

github-actions Bot commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

1 occurrences of :

-    Name: internal,
-    Resource: Quartz.Job.Execute,
+    Name: quartz.job.execute,
+    Resource: execute exceptionJob,
[...]
+    Error: 1,
[...]
+      error.msg: Expected InvalidOperationException thrown,
+      error.stack:
[...]
+      error.type: Quartz.JobExecutionException,
[...]
-      job.group: group1,
-      job.name: helloJob,
-      job.type: QuartzSampleApp.Jobs.HelloJob,
+      job.group: group2,
+      job.name: exceptionJob,
+      job.type: QuartzSampleApp.Jobs.ExceptionJob,
[...]
-      otel.status_code: STATUS_CODE_UNSET,
+      otel.status_code: STATUS_CODE_ERROR,
[...]
-      trigger.group: group1,
-      trigger.name: helloTrigger,
+      trigger.group: group2,
+      trigger.name: exceptionTrigger,

1 occurrences of :

-    Name: internal,
-    Resource: Quartz.Job.Execute,
+    Name: quartz.job.execute,
+    Resource: execute helloJob,
[...]
-    Error: 1,
[...]
-      error.msg: Expected InvalidOperationException thrown,
-      error.stack:
[...]
-      error.type: Quartz.JobExecutionException,
[...]
-      job.group: group2,
-      job.name: exceptionJob,
-      job.type: QuartzSampleApp.Jobs.ExceptionJob,
+      job.group: group1,
+      job.name: helloJob,
+      job.type: QuartzSampleApp.Jobs.HelloJob,
[...]
-      otel.status_code: STATUS_CODE_ERROR,
+      otel.status_code: STATUS_CODE_UNSET,
[...]
-      trigger.group: group2,
-      trigger.name: exceptionTrigger,
+      trigger.group: group1,
+      trigger.name: helloTrigger,

@chojomok
chojomok force-pushed the mohammad/diagnosticobserver_netframework_support branch from 6cbdd75 to 05709b9 Compare November 10, 2025 19:30
Comment on lines +48 to +55
foreach (var tag in activity.Tags)
{
if (tag.Key == "job.name")
{
jobName = tag.Value;
break;
}
}

@andrewlock andrewlock Jan 13, 2026

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.

A couple of performance nits here (that I've only found after diving deep on this stuff recently 😅)

  • In IActivity5, you should use the TagObjects property, not Tags.
  • When enumerating these objects, you should use the new ActivityEnumerationHelper.EnumerateTagObjects helper (as we do now in OtlpHelpers)

Unfortunately, I made that helper a bit too specific, so I need to tweak it before you can use it here I think 😅 I can look into that in a subsequent PR 🙂

@chojomok chojomok Mar 19, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

waited long enough for this to become available! 🕺🏾

@chojomok chojomok added the area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) label Mar 17, 2026
Comment thread tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.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.

LGTM! Nice work!

@chojomok

Copy link
Copy Markdown
Collaborator Author

Need to update the PR summary as we're doing reverse ducktyping

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

Great work! 🎉

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.

@lucaspimentel Do we already have this information anywhere? 🤔

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.

I don't think so. At least not so explicitly.

activity.AddTag(Tags.InstrumentationName, ComponentName);
var jobName = activity.Tags.FirstOrDefault(kv => kv.Key == "job.name").Value ?? string.Empty;

string? jobName = null;

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.

We should probably rework this to be allocation free (the foreach will allocate) but that requires a bunch of refactoring to the ActivityEnumerationHelper so I'm happy to take a look in a follow up PR 😄

#else
private static void StartDiagnosticManager()
{
var observers = new List<DiagnosticObserver>

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.

Braindump:

There's a somewhat interesting knock-on effect of this work... Many integrations change their behavior when there's a diagnostic manager enabled and attached. In particular, this can have performance impacts, and in some cases change real behaviour.

I was considering whether we should check if the quartz integration is actually enabled before enabling this, but given that we can toggle that at runtime, and there's a global switch for disabling the diagnostic source integration entirely, I don't think there's anything more we need to do.

Comment thread docs/development/TracerDebugging.md Outdated
@chojomok
chojomok merged commit 75d765c into master Mar 23, 2026
143 checks passed
@chojomok
chojomok deleted the mohammad/diagnosticobserver_netframework_support branch March 23, 2026 21:48
@github-actions github-actions Bot added this to the vNext-v3 milestone Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants