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

Introduce a SignatureBuilder to build signatures of arbitrary size #6383

Conversation

kevingosse
Copy link
Collaborator

@kevingosse kevingosse commented Dec 3, 2024

Summary of changes

Introduce a SignatureBuilder type to help building signatures of arbitrary size.

Reason for change

Previously, the signatures were built using a stack-allocated buffer of fixed size (1000). We received a crash report that seems to indicate at least one customer has managed to exceed this size.

Implementation details

The new signature builder starts with a stack-allocated buffer of size 1000 (like previously), then switch to a heap-allocated buffer if the signature gets too big.

As an added bonus, it makes the code much cleaner.

Test coverage

Added a probe test with a method that contains 1000 locals. I confirmed that it crashes without the changes.

@kevingosse kevingosse marked this pull request as ready for review December 3, 2024 11:36
@kevingosse kevingosse requested review from a team as code owners December 3, 2024 11:36
@kevingosse kevingosse added area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) identified-by:crashtracking labels Dec 3, 2024 — with Graphite App
@andrewlock
Copy link
Member

andrewlock commented Dec 3, 2024

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 (6383) - mean (69ms)  : 66, 71
     .   : milestone, 69,
    master - mean (69ms)  : 66, 71
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6383) - mean (976ms)  : 955, 997
     .   : milestone, 976,
    master - mean (979ms)  : 953, 1005
     .   : milestone, 979,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6383) - mean (107ms)  : 105, 110
     .   : milestone, 107,
    master - mean (108ms)  : 105, 110
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (6383) - mean (679ms)  : 662, 695
     .   : milestone, 679,
    master - mean (681ms)  : 666, 695
     .   : milestone, 681,

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

    section CallTarget+Inlining+NGEN
    This PR (6383) - mean (626ms)  : 610, 641
     .   : milestone, 626,
    master - mean (633ms)  : 619, 648
     .   : milestone, 633,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6383) - mean (191ms)  : 186, 196
     .   : milestone, 191,
    master - mean (190ms)  : 186, 194
     .   : milestone, 190,

    section CallTarget+Inlining+NGEN
    This PR (6383) - mean (1,092ms)  : 1063, 1120
     .   : milestone, 1092,
    master - mean (1,093ms)  : 1067, 1118
     .   : milestone, 1093,

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

    section CallTarget+Inlining+NGEN
    This PR (6383) - mean (868ms)  : 837, 898
     .   : milestone, 868,
    master - mean (870ms)  : 845, 895
     .   : milestone, 870,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6383) - mean (266ms)  : 261, 271
     .   : milestone, 266,
    master - mean (265ms)  : 261, 269
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (6383) - mean (848ms)  : 817, 879
     .   : milestone, 848,
    master - mean (851ms)  : 816, 887
     .   : milestone, 851,

Loading

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.

Nice

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Dec 3, 2024

Datadog Report

Branch report: 12-03-introduce_a_signaturebuilder_to_build_signatures_of_arbitrary_size
Commit report: 68c938b
Test service: dd-trace-dotnet

✅ 0 Failed, 460716 Passed, 3611 Skipped, 32h 51m 40.78s Total Time
❄️ 1 New Flaky

New Flaky Tests (1)

  • HttpClient_SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.HttpMessageHandlerTests - Last Failure

    Expand for error
     
     Expected collection to contain a single item matching x.IsRequestType("app-closing"), but no such item was found.generate a span, but found False.
    

Copy link
Contributor

@GreenMatan GreenMatan left a comment

Choose a reason for hiding this comment

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

Nicely done. I love this refactoring 👍

@andrewlock
Copy link
Member

Throughput/Crank Report ⚡

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6383) (11.313M)   : 0, 11313150
    master (11.244M)   : 0, 11244017
    benchmarks/2.9.0 (11.033M)   : 0, 11032866

    section Automatic
    This PR (6383) (7.226M)   : 0, 7225688
    master (7.233M)   : 0, 7233234
    benchmarks/2.9.0 (7.786M)   : 0, 7785853

    section Trace stats
    master (7.539M)   : 0, 7538592

    section Manual
    master (11.336M)   : 0, 11335538

    section Manual + Automatic
    This PR (6383) (6.779M)   : 0, 6779102
    master (6.665M)   : 0, 6664929

    section DD_TRACE_ENABLED=0
    master (10.392M)   : 0, 10391691

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6383) (9.599M)   : 0, 9598665
    master (9.589M)   : 0, 9589238
    benchmarks/2.9.0 (9.495M)   : 0, 9494821

    section Automatic
    This PR (6383) (6.395M)   : 0, 6395211
    master (6.401M)   : 0, 6400831

    section Trace stats
    master (6.722M)   : 0, 6721668

    section Manual
    master (9.655M)   : 0, 9655436

    section Manual + Automatic
    This PR (6383) (5.943M)   : 0, 5943484
    master (6.078M)   : 0, 6078388

    section DD_TRACE_ENABLED=0
    master (9.004M)   : 0, 9003534

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6383) (10.470M)   : 0, 10470095
    benchmarks/2.9.0 (10.020M)   : 0, 10019592

    section Automatic
    This PR (6383) (6.650M)   : 0, 6649636
    benchmarks/2.9.0 (7.255M)   : 0, 7255257

    section Manual + Automatic
    This PR (6383) (6.219M)   : 0, 6218995

Loading

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6383 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.151
  • 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 8.04μs 45.7ns 313ns 0.0127 0.00423 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.3μs 53.8ns 309ns 0.0241 0.00963 0 5.8 KB
master StartStopWithChild net472 16.3μs 42.8ns 166ns 1.07 0.345 0.102 6.21 KB
#6383 StartStopWithChild net6.0 7.89μs 42.5ns 233ns 0.0123 0.0041 0 5.62 KB
#6383 StartStopWithChild netcoreapp3.1 9.93μs 57ns 430ns 0.015 0.00501 0 5.8 KB
#6383 StartStopWithChild net472 16.3μs 43.5ns 168ns 1.04 0.298 0.0967 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 503μs 446ns 1.67μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 648μs 456ns 1.77μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 850μs 346ns 1.34μs 0.422 0 0 3.3 KB
#6383 WriteAndFlushEnrichedTraces net6.0 492μs 259ns 1μs 0 0 0 2.7 KB
#6383 WriteAndFlushEnrichedTraces netcoreapp3.1 674μs 355ns 1.33μs 0 0 0 2.7 KB
#6383 WriteAndFlushEnrichedTraces net472 852μs 451ns 1.75μs 0.425 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 159μs 1.27μs 12.3μs 0.147 0 0 14.47 KB
master SendRequest netcoreapp3.1 176μs 1.29μs 12.7μs 0.174 0 0 17.27 KB
master SendRequest net472 0.00173ns 0.000792ns 0.00296ns 0 0 0 0 b
#6383 SendRequest net6.0 145μs 828ns 6.19μs 0.142 0 0 14.47 KB
#6383 SendRequest netcoreapp3.1 166μs 942ns 7.18μs 0.155 0 0 17.27 KB
#6383 SendRequest net472 0.000762ns 0.000391ns 0.00146ns 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 575μs 3.12μs 17.1μs 0.571 0 0 41.63 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 710μs 4.15μs 37.1μs 0.365 0 0 41.79 KB
master WriteAndFlushEnrichedTraces net472 849μs 3.89μs 15.1μs 8.45 2.53 0.422 53.33 KB
#6383 WriteAndFlushEnrichedTraces net6.0 545μs 1.88μs 6.78μs 0.573 0 0 41.62 KB
#6383 WriteAndFlushEnrichedTraces netcoreapp3.1 671μs 3.22μs 12.5μs 0.332 0 0 41.91 KB
#6383 WriteAndFlushEnrichedTraces net472 859μs 3.97μs 15.4μs 8.5 2.55 0.425 53.29 KB
Benchmarks.Trace.DbCommandBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6383

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 1.139 1,421.72 1,248.24

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.42μs 1.23ns 4.78ns 0.0141 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.75μs 1.5ns 5.6ns 0.0139 0 0 1.02 KB
master ExecuteNonQuery net472 2.13μs 2.01ns 7.77ns 0.156 0.00106 0 987 B
#6383 ExecuteNonQuery net6.0 1.25μs 1.01ns 3.92ns 0.0144 0 0 1.02 KB
#6383 ExecuteNonQuery netcoreapp3.1 1.79μs 1.81ns 6.76ns 0.0135 0 0 1.02 KB
#6383 ExecuteNonQuery net472 2.06μs 1.95ns 7.57ns 0.156 0.00103 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.2μs 0.671ns 2.51ns 0.0133 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.53μs 0.756ns 2.93ns 0.0126 0 0 976 B
master CallElasticsearch net472 2.64μs 2.53ns 9.78ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.39μs 0.905ns 3.51ns 0.0132 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 0.907ns 3.39ns 0.014 0 0 1.02 KB
master CallElasticsearchAsync net472 2.56μs 1.89ns 7.33ns 0.166 0 0 1.05 KB
#6383 CallElasticsearch net6.0 1.26μs 0.59ns 2.21ns 0.0139 0 0 976 B
#6383 CallElasticsearch netcoreapp3.1 1.53μs 1.23ns 4.59ns 0.0131 0 0 976 B
#6383 CallElasticsearch net472 2.59μs 2.48ns 9.6ns 0.157 0 0 995 B
#6383 CallElasticsearchAsync net6.0 1.26μs 0.706ns 2.64ns 0.0132 0 0 952 B
#6383 CallElasticsearchAsync netcoreapp3.1 1.6μs 0.627ns 2.43ns 0.0135 0 0 1.02 KB
#6383 CallElasticsearchAsync net472 2.63μs 1.34ns 5.02ns 0.166 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.33μs 1.38ns 5.17ns 0.0134 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.72μs 0.988ns 3.83ns 0.013 0 0 952 B
master ExecuteAsync net472 1.93μs 0.688ns 2.58ns 0.145 0 0 915 B
#6383 ExecuteAsync net6.0 1.24μs 0.6ns 2.24ns 0.013 0 0 952 B
#6383 ExecuteAsync netcoreapp3.1 1.55μs 0.562ns 2.03ns 0.0124 0 0 952 B
#6383 ExecuteAsync net472 1.89μs 0.693ns 2.69ns 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.39μs 1.16ns 4.17ns 0.0329 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.48μs 2.27ns 8.8ns 0.0384 0 0 2.85 KB
master SendAsync net472 7.17μs 0.965ns 3.74ns 0.494 0 0 3.12 KB
#6383 SendAsync net6.0 4.44μs 2.12ns 8.22ns 0.0332 0 0 2.31 KB
#6383 SendAsync netcoreapp3.1 5.49μs 1.15ns 4.28ns 0.0384 0 0 2.85 KB
#6383 SendAsync net472 7.36μs 2.21ns 8.54ns 0.493 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.57μs 0.717ns 2.68ns 0.0236 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.29μs 4.95ns 19.2ns 0.0216 0 0 1.64 KB
master EnrichedLog net472 2.68μs 1.01ns 3.91ns 0.249 0 0 1.57 KB
#6383 EnrichedLog net6.0 1.45μs 0.818ns 3.06ns 0.0229 0 0 1.64 KB
#6383 EnrichedLog netcoreapp3.1 2.22μs 0.985ns 3.68ns 0.0221 0 0 1.64 KB
#6383 EnrichedLog net472 2.54μs 3.39ns 12.2ns 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 121μs 109ns 409ns 0.0604 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 124μs 117ns 455ns 0 0 0 4.28 KB
master EnrichedLog net472 154μs 164ns 634ns 0.688 0.229 0 4.46 KB
#6383 EnrichedLog net6.0 120μs 143ns 552ns 0 0 0 4.28 KB
#6383 EnrichedLog netcoreapp3.1 123μs 118ns 410ns 0 0 0 4.28 KB
#6383 EnrichedLog net472 153μs 117ns 439ns 0.691 0.23 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 2.99μs 0.709ns 2.75ns 0.0299 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.15μs 1.29ns 4.83ns 0.0292 0 0 2.2 KB
master EnrichedLog net472 4.96μs 1.09ns 4.07ns 0.319 0 0 2.02 KB
#6383 EnrichedLog net6.0 3.11μs 0.863ns 3.34ns 0.031 0 0 2.2 KB
#6383 EnrichedLog netcoreapp3.1 4.1μs 2.16ns 8.36ns 0.0287 0 0 2.2 KB
#6383 EnrichedLog net472 4.84μs 1.3ns 5.04ns 0.32 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6383

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 1.139 1,458.66 1,280.22

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.46μs 0.803ns 3.11ns 0.016 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.69μs 0.851ns 3.3ns 0.0152 0 0 1.14 KB
master SendReceive net472 2.06μs 1.25ns 4.83ns 0.184 0 0 1.16 KB
#6383 SendReceive net6.0 1.28μs 0.974ns 3.64ns 0.0161 0 0 1.14 KB
#6383 SendReceive netcoreapp3.1 1.84μs 1.66ns 6.44ns 0.0156 0 0 1.14 KB
#6383 SendReceive net472 2.04μs 1.32ns 5.1ns 0.183 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.67μs 1.05ns 4.06ns 0.0217 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.99μs 1.54ns 5.95ns 0.0219 0 0 1.65 KB
master EnrichedLog net472 4.46μs 3.88ns 15ns 0.323 0 0 2.04 KB
#6383 EnrichedLog net6.0 2.87μs 1.01ns 3.9ns 0.0215 0 0 1.6 KB
#6383 EnrichedLog netcoreapp3.1 3.78μs 3.01ns 11.3ns 0.0227 0 0 1.65 KB
#6383 EnrichedLog net472 4.3μs 2.06ns 7.7ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 392ns 0.195ns 0.756ns 0.00806 0 0 576 B
master StartFinishSpan netcoreapp3.1 606ns 3.34ns 18.9ns 0.00783 0 0 576 B
master StartFinishSpan net472 631ns 0.61ns 2.36ns 0.0918 0 0 578 B
master StartFinishScope net6.0 490ns 0.247ns 0.958ns 0.00978 0 0 696 B
master StartFinishScope netcoreapp3.1 785ns 0.477ns 1.85ns 0.00945 0 0 696 B
master StartFinishScope net472 853ns 0.628ns 2.43ns 0.104 0 0 658 B
#6383 StartFinishSpan net6.0 399ns 0.491ns 1.9ns 0.00802 0 0 576 B
#6383 StartFinishSpan netcoreapp3.1 558ns 0.72ns 2.79ns 0.00776 0 0 576 B
#6383 StartFinishSpan net472 633ns 1.22ns 4.57ns 0.0917 0 0 578 B
#6383 StartFinishScope net6.0 491ns 0.671ns 2.6ns 0.00982 0 0 696 B
#6383 StartFinishScope netcoreapp3.1 738ns 2.81ns 10.9ns 0.00949 0 0 696 B
#6383 StartFinishScope net472 827ns 1.99ns 7.72ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6383

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.174 695.50 592.42

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 696ns 0.399ns 1.55ns 0.0097 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 904ns 1.49ns 5.79ns 0.00946 0 0 696 B
master RunOnMethodBegin net472 1.1μs 0.804ns 3.11ns 0.104 0 0 658 B
#6383 RunOnMethodBegin net6.0 593ns 1.02ns 3.94ns 0.00983 0 0 696 B
#6383 RunOnMethodBegin netcoreapp3.1 968ns 0.702ns 2.72ns 0.00941 0 0 696 B
#6383 RunOnMethodBegin net472 1.16μs 1.86ns 7.19ns 0.104 0 0 658 B

@kevingosse kevingosse merged commit b84a681 into master Dec 4, 2024
76 of 83 checks passed
@kevingosse kevingosse deleted the 12-03-introduce_a_signaturebuilder_to_build_signatures_of_arbitrary_size branch December 4, 2024 12:22
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 4, 2024
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…6383)

## Summary of changes

Introduce a SignatureBuilder type to help building signatures of
arbitrary size.

## Reason for change

Previously, the signatures were built using a stack-allocated buffer of
fixed size (1000). We received a crash report that seems to indicate at
least one customer has managed to exceed this size.

## Implementation details

The new signature builder starts with a stack-allocated buffer of size
1000 (like previously), then switch to a heap-allocated buffer if the
signature gets too big.

As an added bonus, it makes the code much cleaner.

## Test coverage

Added a probe test with a method that contains 1000 locals. I confirmed
that it crashes without the changes.

<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) identified-by:crashtracking type:refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants