Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reapply "Add Google Protobuf Instrumentation" #6647

Merged
merged 13 commits into from
Feb 20, 2025
Merged

Reapply "Add Google Protobuf Instrumentation" #6647

merged 13 commits into from
Feb 20, 2025

Conversation

vandonr
Copy link
Contributor

@vandonr vandonr commented Feb 10, 2025

Summary of changes

same as #6166 except with:

  • fixes by @bouwkast from Attempt to fix Samples.GoogleProtobuf errors #6640
  • gave up on generating the proto object file on the fly
  • fixed a couple inconsistency issues I discovered when system-testing vs the Java instrumentation (depth calculation was one-off, int value of types were not in sync, and we were not using the full name for references)

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Feb 10, 2025

Datadog Report

Branch report: vandonr/proto
Commit report: eb78da2
Test service: dd-trace-dotnet

✅ 0 Failed, 570476 Passed, 5469 Skipped, 45h 58m 33.39s Total Time

@andrewlock
Copy link
Member

andrewlock commented Feb 10, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

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 shown 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).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6647) - mean (71ms)  : 62, 81
     .   : milestone, 71,
    master - mean (69ms)  : 65, 73
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6647) - mean (1,015ms)  : 956, 1074
     .   : milestone, 1015,
    master - mean (1,001ms)  : 978, 1024
     .   : milestone, 1001,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6647) - mean (103ms)  : 101, 105
     .   : milestone, 103,
    master - mean (102ms)  : 100, 105
     .   : milestone, 102,

    section CallTarget+Inlining+NGEN
    This PR (6647) - mean (679ms)  : 659, 698
     .   : milestone, 679,
    master - mean (676ms)  : 659, 693
     .   : milestone, 676,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6647) - mean (90ms)  : 87, 92
     .   : milestone, 90,
    master - mean (89ms)  : 87, 91
     .   : milestone, 89,

    section CallTarget+Inlining+NGEN
    This PR (6647) - mean (631ms)  : 611, 651
     .   : milestone, 631,
    master - mean (632ms)  : 616, 648
     .   : milestone, 632,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6647) - mean (191ms)  : 185, 197
     .   : milestone, 191,
    master - mean (191ms)  : 187, 195
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (6647) - mean (1,105ms)  : 1074, 1135
     .   : milestone, 1105,
    master - mean (1,108ms)  : 1072, 1144
     .   : milestone, 1108,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6647) - mean (271ms)  : 266, 276
     .   : milestone, 271,
    master - mean (270ms)  : 264, 276
     .   : milestone, 270,

    section CallTarget+Inlining+NGEN
    This PR (6647) - mean (862ms)  : 832, 892
     .   : milestone, 862,
    master - mean (863ms)  : 834, 892
     .   : milestone, 863,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6647) - mean (263ms)  : 259, 267
     .   : milestone, 263,
    master - mean (263ms)  : 259, 267
     .   : milestone, 263,

    section CallTarget+Inlining+NGEN
    This PR (6647) - mean (839ms)  : 810, 868
     .   : milestone, 839,
    master - mean (844ms)  : 806, 882
     .   : milestone, 844,

Loading

Copy link
Contributor

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

Looks like some merge conflicts

@andrewlock
Copy link
Member

andrewlock commented Feb 10, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6647 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.207
  • 1 benchmarks are slower, with geometric mean 1.126
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.86μs 43ns 262ns 0.0203 0.00811 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.1μs 55.5ns 324ns 0.0199 0.00996 0 5.8 KB
master StartStopWithChild net472 15.9μs 38.1ns 142ns 1.04 0.307 0.0944 6.21 KB
#6647 StartStopWithChild net6.0 7.8μs 39.4ns 172ns 0.0167 0.00833 0 5.61 KB
#6647 StartStopWithChild netcoreapp3.1 9.81μs 52.1ns 299ns 0.0285 0.0143 0 5.8 KB
#6647 StartStopWithChild net472 15.9μs 44.8ns 173ns 1.05 0.318 0.0932 6.22 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 492μs 486ns 1.82μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 700μs 282ns 1.05μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 848μs 626ns 2.34μs 0.422 0 0 3.3 KB
#6647 WriteAndFlushEnrichedTraces net6.0 480μs 399ns 1.54μs 0 0 0 2.7 KB
#6647 WriteAndFlushEnrichedTraces netcoreapp3.1 673μs 496ns 1.92μs 0 0 0 2.7 KB
#6647 WriteAndFlushEnrichedTraces net472 847μs 501ns 1.94μs 0.422 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 132μs 417ns 1.61μs 0.135 0 0 14.47 KB
master SendRequest netcoreapp3.1 147μs 396ns 1.53μs 0.22 0 0 17.27 KB
master SendRequest net472 0.00199ns 0.000288ns 0.00112ns 0 0 0 0 b
#6647 SendRequest net6.0 131μs 554ns 2.14μs 0.131 0 0 14.47 KB
#6647 SendRequest netcoreapp3.1 152μs 127ns 474ns 0.229 0 0 17.27 KB
#6647 SendRequest net472 0.000395ns 0.000212ns 0.000822ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 608μs 3.32μs 18.8μs 0.604 0 0 41.87 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 670μs 3.78μs 27.5μs 0.338 0 0 41.69 KB
master WriteAndFlushEnrichedTraces net472 840μs 2.83μs 10.6μs 8.22 2.47 0.411 53.34 KB
#6647 WriteAndFlushEnrichedTraces net6.0 573μs 3.13μs 22.6μs 0.556 0 0 41.72 KB
#6647 WriteAndFlushEnrichedTraces netcoreapp3.1 673μs 3.88μs 30.8μs 0.349 0 0 41.82 KB
#6647 WriteAndFlushEnrichedTraces net472 841μs 3.14μs 12.1μs 8.22 2.47 0.411 53.29 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.44μs 2.09ns 8.1ns 0.0138 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.75μs 2.38ns 9.22ns 0.0139 0 0 1.02 KB
master ExecuteNonQuery net472 2.07μs 4.15ns 16.1ns 0.156 0.00103 0 987 B
#6647 ExecuteNonQuery net6.0 1.35μs 1.25ns 4.83ns 0.0142 0 0 1.02 KB
#6647 ExecuteNonQuery netcoreapp3.1 1.86μs 2.26ns 8.75ns 0.0138 0 0 1.02 KB
#6647 ExecuteNonQuery net472 1.99μs 1.26ns 4.87ns 0.156 0.000988 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.21μs 0.404ns 1.51ns 0.0139 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.5μs 0.958ns 3.59ns 0.0128 0 0 976 B
master CallElasticsearch net472 2.46μs 2.36ns 9.14ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.37μs 1.01ns 3.76ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.71μs 0.965ns 3.61ns 0.0139 0 0 1.02 KB
master CallElasticsearchAsync net472 2.67μs 1.97ns 7.63ns 0.166 0 0 1.05 KB
#6647 CallElasticsearch net6.0 1.2μs 0.765ns 2.96ns 0.0133 0 0 976 B
#6647 CallElasticsearch netcoreapp3.1 1.54μs 1.02ns 3.83ns 0.0132 0 0 976 B
#6647 CallElasticsearch net472 2.49μs 2.6ns 10.1ns 0.158 0 0 995 B
#6647 CallElasticsearchAsync net6.0 1.29μs 0.713ns 2.67ns 0.0136 0 0 952 B
#6647 CallElasticsearchAsync netcoreapp3.1 1.68μs 0.985ns 3.55ns 0.0141 0 0 1.02 KB
#6647 CallElasticsearchAsync net472 2.7μs 1.41ns 5.27ns 0.167 0 0 1.05 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.44μs 1.02ns 3.96ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.71μs 0.954ns 3.7ns 0.012 0 0 952 B
master ExecuteAsync net472 1.86μs 0.559ns 2.09ns 0.145 0 0 915 B
#6647 ExecuteAsync net6.0 1.35μs 1.91ns 7.4ns 0.0135 0 0 952 B
#6647 ExecuteAsync netcoreapp3.1 1.68μs 0.282ns 1.02ns 0.0126 0 0 952 B
#6647 ExecuteAsync net472 1.85μs 1.07ns 4.14ns 0.145 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 4.41μs 1.19ns 4.47ns 0.0331 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.35μs 3.47ns 13ns 0.0374 0 0 2.85 KB
master SendAsync net472 7.37μs 2.03ns 7.85ns 0.495 0 0 3.12 KB
#6647 SendAsync net6.0 4.38μs 1.29ns 4.82ns 0.0307 0 0 2.31 KB
#6647 SendAsync netcoreapp3.1 5.28μs 2.84ns 11ns 0.0395 0 0 2.85 KB
#6647 SendAsync net472 7.43μs 1.82ns 7.06ns 0.495 0 0 3.12 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.58μs 0.493ns 1.78ns 0.023 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.19μs 1.07ns 3.99ns 0.0228 0 0 1.64 KB
master EnrichedLog net472 2.67μs 4.35ns 16.9ns 0.25 0 0 1.57 KB
#6647 EnrichedLog net6.0 1.54μs 0.515ns 1.93ns 0.0233 0 0 1.64 KB
#6647 EnrichedLog netcoreapp3.1 2.16μs 1.22ns 4.57ns 0.0219 0 0 1.64 KB
#6647 EnrichedLog net472 2.63μs 1.26ns 4.89ns 0.249 0 0 1.57 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 112μs 212ns 822ns 0.0558 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 117μs 148ns 573ns 0.0582 0 0 4.28 KB
master EnrichedLog net472 151μs 82.1ns 307ns 0.681 0.227 0 4.46 KB
#6647 EnrichedLog net6.0 114μs 299ns 1.16μs 0.0566 0 0 4.28 KB
#6647 EnrichedLog netcoreapp3.1 118μs 192ns 742ns 0.0581 0 0 4.28 KB
#6647 EnrichedLog net472 149μs 186ns 720ns 0.669 0.223 0 4.46 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 3.11μs 0.496ns 1.72ns 0.0311 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.2μs 2.35ns 8.79ns 0.0294 0 0 2.2 KB
master EnrichedLog net472 5.03μs 1.01ns 3.79ns 0.32 0 0 2.02 KB
#6647 EnrichedLog net6.0 3.13μs 0.888ns 3.44ns 0.0313 0 0 2.2 KB
#6647 EnrichedLog netcoreapp3.1 4.13μs 1.53ns 5.73ns 0.0289 0 0 2.2 KB
#6647 EnrichedLog net472 4.8μs 1.63ns 5.87ns 0.32 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.27μs 0.38ns 1.47ns 0.0159 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.77μs 0.486ns 1.68ns 0.015 0 0 1.14 KB
master SendReceive net472 2.12μs 2.85ns 11.1ns 0.183 0 0 1.16 KB
#6647 SendReceive net6.0 1.32μs 0.429ns 1.55ns 0.0159 0 0 1.14 KB
#6647 SendReceive netcoreapp3.1 1.68μs 0.911ns 3.53ns 0.0152 0 0 1.14 KB
#6647 SendReceive net472 2.07μs 0.682ns 2.64ns 0.184 0 0 1.16 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.77μs 1.19ns 4.44ns 0.022 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.97μs 5.6ns 20.9ns 0.0217 0 0 1.65 KB
master EnrichedLog net472 4.3μs 3.26ns 12.6ns 0.323 0 0 2.04 KB
#6647 EnrichedLog net6.0 2.8μs 3.22ns 12.5ns 0.0225 0 0 1.6 KB
#6647 EnrichedLog netcoreapp3.1 3.77μs 1.03ns 3.98ns 0.0228 0 0 1.65 KB
#6647 EnrichedLog net472 4.28μs 3.8ns 14.7ns 0.322 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6647

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.126 557.60 627.92

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 391ns 0.461ns 1.79ns 0.00817 0 0 576 B
master StartFinishSpan netcoreapp3.1 557ns 0.82ns 3.18ns 0.00784 0 0 576 B
master StartFinishSpan net472 584ns 1.27ns 4.91ns 0.0915 0 0 578 B
master StartFinishScope net6.0 515ns 0.487ns 1.89ns 0.00983 0 0 696 B
master StartFinishScope netcoreapp3.1 742ns 1.68ns 6.07ns 0.00932 0 0 696 B
master StartFinishScope net472 839ns 2.27ns 8.78ns 0.105 0 0 658 B
#6647 StartFinishSpan net6.0 391ns 0.637ns 2.47ns 0.00817 0 0 576 B
#6647 StartFinishSpan netcoreapp3.1 629ns 1.08ns 4.19ns 0.0079 0 0 576 B
#6647 StartFinishSpan net472 626ns 1.4ns 5.26ns 0.0917 0 0 578 B
#6647 StartFinishScope net6.0 502ns 0.829ns 3.1ns 0.00992 0 0 696 B
#6647 StartFinishScope netcoreapp3.1 698ns 1.69ns 6.09ns 0.00936 0 0 696 B
#6647 StartFinishScope net472 778ns 1.96ns 7.58ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6647

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 1.239 1,162.68 938.31
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.175 731.18 622.02

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 733ns 1.3ns 5.05ns 0.00951 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 907ns 1.48ns 5.73ns 0.00936 0 0 696 B
master RunOnMethodBegin net472 1.16μs 1.52ns 5.88ns 0.105 0 0 658 B
#6647 RunOnMethodBegin net6.0 623ns 1.2ns 4.66ns 0.00979 0 0 696 B
#6647 RunOnMethodBegin netcoreapp3.1 955ns 1.97ns 7.64ns 0.00915 0 0 696 B
#6647 RunOnMethodBegin net472 940ns 3.23ns 11.6ns 0.104 0 0 658 B

@vandonr vandonr marked this pull request as draft February 13, 2025 09:37
@vandonr vandonr marked this pull request as ready for review February 18, 2025 16:35
Copy link
Contributor

@bouwkast bouwkast 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 reviewed the new changes as the rest was already reviewed previously

@vandonr vandonr merged commit 3552149 into master Feb 20, 2025
148 of 150 checks passed
@vandonr vandonr deleted the vandonr/proto branch February 20, 2025 16:18
@github-actions github-actions bot added this to the vNext-v3 milestone Feb 20, 2025
@andrewlock andrewlock added the area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) label Feb 24, 2025
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) area:data-streams-monitoring area:integrations type:new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants