Skip to content

Vendor in Microsoft.OpenApi #6461

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

Merged
merged 10 commits into from
Jan 14, 2025
Merged

Vendor in Microsoft.OpenApi #6461

merged 10 commits into from
Jan 14, 2025

Conversation

vandonr
Copy link
Contributor

@vandonr vandonr commented Dec 19, 2024

Summary of changes

added the code of Microsoft.OpenApi to the tracer, removed/changed the parts that require more recent versions of the language/fwk than we have, and updated generated files.

Reason for change

It's going to be needed for the protobuf instrumentation in #6166, and I'm doing it in a separate PR to limit the size of the diff in the actual change.

Implementation details

@bouwkast ran the vendoring tool to add the files, since it's not working on Mac apparently

Test coverage

Other details

When looking at the size of artefacts published on the CI, it looks like this is increasing the size of the dll by ~180KiB

@vandonr vandonr requested review from a team as code owners December 19, 2024 09:40
@andrewlock
Copy link
Member

andrewlock commented Dec 19, 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 (6461) - mean (69ms)  : 66, 72
     .   : milestone, 69,
    master - mean (69ms)  : 66, 71
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6461) - mean (983ms)  : 954, 1011
     .   : milestone, 983,
    master - mean (981ms)  : 957, 1004
     .   : milestone, 981,

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

    section CallTarget+Inlining+NGEN
    This PR (6461) - mean (679ms)  : 664, 694
     .   : milestone, 679,
    master - mean (678ms)  : 665, 692
     .   : milestone, 678,

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

    section CallTarget+Inlining+NGEN
    This PR (6461) - mean (635ms)  : 619, 650
     .   : milestone, 635,
    master - mean (636ms)  : 620, 652
     .   : milestone, 636,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6461) - mean (194ms)  : 189, 198
     .   : milestone, 194,
    master - mean (194ms)  : 189, 198
     .   : milestone, 194,

    section CallTarget+Inlining+NGEN
    This PR (6461) - mean (1,104ms)  : 1072, 1135
     .   : milestone, 1104,
    master - mean (1,103ms)  : 1076, 1130
     .   : milestone, 1103,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6461) - mean (278ms)  : 275, 281
     .   : milestone, 278,
    master - mean (280ms)  : 276, 284
     .   : milestone, 280,

    section CallTarget+Inlining+NGEN
    This PR (6461) - mean (873ms)  : 841, 904
     .   : milestone, 873,
    master - mean (873ms)  : 849, 897
     .   : milestone, 873,

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

    section CallTarget+Inlining+NGEN
    This PR (6461) - mean (848ms)  : 827, 870
     .   : milestone, 848,
    master - mean (856ms)  : 821, 890
     .   : milestone, 856,

Loading

@andrewlock
Copy link
Member

andrewlock commented Dec 19, 2024

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 (6461) (11.209M)   : 0, 11209227
    master (11.152M)   : 0, 11152447
    benchmarks/2.9.0 (11.144M)   : 0, 11143547

    section Automatic
    This PR (6461) (7.426M)   : 0, 7425806
    master (7.354M)   : 0, 7353844
    benchmarks/2.9.0 (7.982M)   : 0, 7981525

    section Trace stats
    master (7.558M)   : 0, 7558154

    section Manual
    master (11.199M)   : 0, 11198717

    section Manual + Automatic
    This PR (6461) (6.794M)   : 0, 6793605
    master (6.716M)   : 0, 6715949

    section DD_TRACE_ENABLED=0
    master (10.213M)   : 0, 10213385

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6461) (9.654M)   : 0, 9653861
    benchmarks/2.9.0 (9.621M)   : 0, 9621397

    section Automatic
    This PR (6461) (6.367M)   : 0, 6367403

    section Manual + Automatic
    This PR (6461) (6.013M)   : 0, 6013497

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6461) (10.361M)   : 0, 10361171
    master (10.200M)   : 0, 10200189

    section Automatic
    This PR (6461) (6.886M)   : 0, 6885640
    master (6.736M)   : 0, 6735703

    section Trace stats
    master (7.380M)   : 0, 7380123

    section Manual
    master (10.350M)   : 0, 10350365

    section Manual + Automatic
    This PR (6461) (6.593M)   : 0, 6592644
    master (6.235M)   : 0, 6234677

    section DD_TRACE_ENABLED=0
    master (9.495M)   : 0, 9495186

Loading

@andrewlock
Copy link
Member

andrewlock commented Dec 19, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #6461 compared to master:

  • All benchmarks have the same speed
  • 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.09μs 46.6ns 361ns 0.0121 0.00404 0 5.62 KB
master StartStopWithChild netcoreapp3.1 10.4μs 57.6ns 341ns 0.0211 0.0106 0 5.8 KB
master StartStopWithChild net472 16.3μs 53.1ns 206ns 1.03 0.31 0.0875 6.2 KB
#6461 StartStopWithChild net6.0 8.13μs 45.9ns 297ns 0.016 0.00799 0 5.61 KB
#6461 StartStopWithChild netcoreapp3.1 9.9μs 55.6ns 352ns 0.0147 0.00491 0 5.8 KB
#6461 StartStopWithChild net472 16.5μs 24.4ns 91.4ns 1.05 0.31 0.098 6.21 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 476μs 389ns 1.5μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 641μs 615ns 2.38μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 859μs 460ns 1.72μs 0.428 0 0 3.3 KB
#6461 WriteAndFlushEnrichedTraces net6.0 487μs 379ns 1.42μs 0 0 0 2.7 KB
#6461 WriteAndFlushEnrichedTraces netcoreapp3.1 637μs 437ns 1.63μs 0 0 0 2.7 KB
#6461 WriteAndFlushEnrichedTraces net472 863μs 1.58μs 6.13μs 0.431 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 152μs 893ns 8.75μs 0.149 0 0 14.47 KB
master SendRequest netcoreapp3.1 176μs 1.07μs 10.5μs 0.18 0 0 17.27 KB
master SendRequest net472 0.00113ns 0.000465ns 0.00174ns 0 0 0 0 b
#6461 SendRequest net6.0 159μs 1.04μs 10.2μs 0.211 0 0 14.47 KB
#6461 SendRequest netcoreapp3.1 175μs 1.31μs 12.9μs 0.163 0 0 17.27 KB
#6461 SendRequest net472 0.000142ns 0.000142ns 0.000551ns 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 570μs 3.08μs 17.4μs 0.553 0 0 41.68 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 650μs 3.38μs 19.1μs 0.345 0 0 41.67 KB
master WriteAndFlushEnrichedTraces net472 855μs 4.22μs 19.3μs 8.08 2.55 0.425 53.31 KB
#6461 WriteAndFlushEnrichedTraces net6.0 579μs 3.11μs 16.4μs 0.573 0 0 41.81 KB
#6461 WriteAndFlushEnrichedTraces netcoreapp3.1 719μs 3.91μs 22.1μs 0.338 0 0 41.66 KB
#6461 WriteAndFlushEnrichedTraces net472 830μs 3.63μs 14.1μs 8.12 2.44 0.406 53.24 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.39μs 1.85ns 7.15ns 0.0144 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.83μs 1.72ns 6.65ns 0.0137 0 0 1.02 KB
master ExecuteNonQuery net472 2.09μs 2.32ns 8.98ns 0.156 0.00104 0 987 B
#6461 ExecuteNonQuery net6.0 1.3μs 1.39ns 5.39ns 0.0143 0 0 1.02 KB
#6461 ExecuteNonQuery netcoreapp3.1 1.71μs 3.63ns 14.1ns 0.0136 0 0 1.02 KB
#6461 ExecuteNonQuery net472 2.11μs 2.77ns 10.7ns 0.156 0.00106 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.22μs 0.658ns 2.46ns 0.0135 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.63μs 0.505ns 1.96ns 0.013 0 0 976 B
master CallElasticsearch net472 2.53μs 1.29ns 4.65ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.28μs 0.405ns 1.51ns 0.0129 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.62μs 1.19ns 4.61ns 0.0139 0 0 1.02 KB
master CallElasticsearchAsync net472 2.6μs 0.87ns 3.25ns 0.166 0 0 1.05 KB
#6461 CallElasticsearch net6.0 1.33μs 0.449ns 1.68ns 0.0139 0 0 976 B
#6461 CallElasticsearch netcoreapp3.1 1.55μs 0.776ns 2.8ns 0.013 0 0 976 B
#6461 CallElasticsearch net472 2.6μs 3.11ns 12ns 0.158 0 0 995 B
#6461 CallElasticsearchAsync net6.0 1.38μs 0.493ns 1.91ns 0.0132 0 0 952 B
#6461 CallElasticsearchAsync netcoreapp3.1 1.74μs 0.689ns 2.58ns 0.0139 0 0 1.02 KB
#6461 CallElasticsearchAsync net472 2.63μs 1.87ns 7.23ns 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.26μs 2.35ns 9.11ns 0.0132 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.6μs 1.41ns 5.45ns 0.0128 0 0 952 B
master ExecuteAsync net472 1.84μs 0.798ns 2.99ns 0.145 0 0 915 B
#6461 ExecuteAsync net6.0 1.38μs 0.867ns 3ns 0.0132 0 0 952 B
#6461 ExecuteAsync netcoreapp3.1 1.62μs 0.714ns 2.67ns 0.013 0 0 952 B
#6461 ExecuteAsync net472 1.87μs 0.582ns 2.26ns 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.34μs 1.25ns 4.84ns 0.0304 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.33μs 1.55ns 6ns 0.0372 0 0 2.85 KB
master SendAsync net472 7.37μs 2.74ns 10.2ns 0.493 0 0 3.12 KB
#6461 SendAsync net6.0 4.48μs 1.4ns 5.06ns 0.0312 0 0 2.31 KB
#6461 SendAsync netcoreapp3.1 5.41μs 3.31ns 12.8ns 0.0381 0 0 2.85 KB
#6461 SendAsync net472 7.43μs 2.34ns 9.06ns 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.46μs 3.33ns 12.9ns 0.0232 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.17μs 0.687ns 2.57ns 0.0219 0 0 1.64 KB
master EnrichedLog net472 2.67μs 1.57ns 5.44ns 0.249 0 0 1.57 KB
#6461 EnrichedLog net6.0 1.56μs 1.1ns 4.13ns 0.0232 0 0 1.64 KB
#6461 EnrichedLog netcoreapp3.1 2.09μs 0.992ns 3.71ns 0.0222 0 0 1.64 KB
#6461 EnrichedLog net472 2.68μs 1.1ns 4.27ns 0.25 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 119μs 114ns 440ns 0 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 123μs 224ns 868ns 0 0 0 4.28 KB
master EnrichedLog net472 153μs 159ns 616ns 0.687 0.229 0 4.46 KB
#6461 EnrichedLog net6.0 117μs 136ns 507ns 0.0584 0 0 4.28 KB
#6461 EnrichedLog netcoreapp3.1 124μs 129ns 466ns 0 0 0 4.28 KB
#6461 EnrichedLog net472 154μs 195ns 754ns 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 3.05μs 1.17ns 4.53ns 0.0305 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.16μs 1.01ns 3.63ns 0.0293 0 0 2.2 KB
master EnrichedLog net472 4.99μs 1.63ns 6.31ns 0.32 0 0 2.02 KB
#6461 EnrichedLog net6.0 2.95μs 1.21ns 4.7ns 0.031 0 0 2.2 KB
#6461 EnrichedLog netcoreapp3.1 4.21μs 1.33ns 5.15ns 0.0296 0 0 2.2 KB
#6461 EnrichedLog net472 4.93μs 1.25ns 4.84ns 0.319 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.29μs 0.626ns 2.42ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.76μs 0.496ns 1.86ns 0.015 0 0 1.14 KB
master SendReceive net472 2.1μs 1.05ns 3.78ns 0.183 0 0 1.16 KB
#6461 SendReceive net6.0 1.34μs 1.48ns 5.35ns 0.0159 0 0 1.14 KB
#6461 SendReceive netcoreapp3.1 1.82μs 0.612ns 2.29ns 0.0155 0 0 1.14 KB
#6461 SendReceive net472 2.17μs 2.12ns 8.21ns 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.8μs 0.896ns 3.47ns 0.0224 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.89μs 2.42ns 9.35ns 0.0214 0 0 1.65 KB
master EnrichedLog net472 4.4μs 2.15ns 8.05ns 0.322 0 0 2.04 KB
#6461 EnrichedLog net6.0 2.69μs 0.676ns 2.34ns 0.0215 0 0 1.6 KB
#6461 EnrichedLog netcoreapp3.1 3.95μs 2.4ns 9.28ns 0.0218 0 0 1.65 KB
#6461 EnrichedLog net472 4.53μs 2.68ns 10.4ns 0.324 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 398ns 0.17ns 0.659ns 0.00803 0 0 576 B
master StartFinishSpan netcoreapp3.1 549ns 0.676ns 2.62ns 0.00766 0 0 576 B
master StartFinishSpan net472 674ns 0.328ns 1.23ns 0.0916 0 0 578 B
master StartFinishScope net6.0 513ns 0.294ns 1.1ns 0.00968 0 0 696 B
master StartFinishScope netcoreapp3.1 814ns 0.646ns 2.33ns 0.00913 0 0 696 B
master StartFinishScope net472 903ns 0.762ns 2.95ns 0.104 0 0 658 B
#6461 StartFinishSpan net6.0 405ns 0.218ns 0.844ns 0.00809 0 0 576 B
#6461 StartFinishSpan netcoreapp3.1 607ns 0.558ns 2.16ns 0.00783 0 0 576 B
#6461 StartFinishSpan net472 710ns 0.36ns 1.39ns 0.0917 0 0 578 B
#6461 StartFinishScope net6.0 536ns 0.193ns 0.747ns 0.00971 0 0 696 B
#6461 StartFinishScope netcoreapp3.1 764ns 0.426ns 1.59ns 0.00965 0 0 696 B
#6461 StartFinishScope net472 897ns 0.241ns 0.935ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 638ns 0.272ns 1.05ns 0.00957 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 899ns 0.5ns 1.87ns 0.00907 0 0 696 B
master RunOnMethodBegin net472 1.11μs 0.93ns 3.6ns 0.104 0 0 658 B
#6461 RunOnMethodBegin net6.0 596ns 0.353ns 1.37ns 0.00956 0 0 696 B
#6461 RunOnMethodBegin netcoreapp3.1 881ns 0.356ns 1.28ns 0.00921 0 0 696 B
#6461 RunOnMethodBegin net472 1.06μs 0.513ns 1.92ns 0.104 0 0 658 B

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Dec 19, 2024

Datadog Report

Branch report: vandonr/vendored
Commit report: 19e2003
Test service: dd-trace-dotnet

✅ 0 Failed, 239484 Passed, 2118 Skipped, 19h 25m 12.7s Total Time

Copy link
Member

Choose a reason for hiding this comment

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

I doubt we want to vendor in the SRResource.resx files? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we do, because it's referenced everywhere, in error messages for instance

Copy link
Member

Choose a reason for hiding this comment

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

The designer file is referenced (as that has the c# code) but I don't think we need the resx files themselves

Copy link
Contributor Author

@vandonr vandonr Jan 2, 2025

Choose a reason for hiding this comment

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

Yes you are right, I don't think the resx file is needed at compile time, however it contains the values for all the error messages. I guess this means if there is an error, then there will be an error within the error when trying to get the error message. Maybe it's OK ?

Copy link
Member

@andrewlock andrewlock Jan 2, 2025

Choose a reason for hiding this comment

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

Urgh, you're right, for some reason I thought the designer.cs code included hard-coded versions of the resx. That said, is this actually being used anyway 🤔 IIRC you have to embed the resx file for this to work. Frankly I'd be inclined to do some munging and hardcode it to avoid the bloat.

if there is an error, then there will be an error within the error

Yeah the more important point though is yes, if this happens, Bad Things™ will likely happen, so we need to make sure it's "working" correctly either way, whether that's with hard coding/stripping it out/Or embedding (note that we don't embed any other resx files, I'm not massively inclined to start, personally 😄)

Copy link
Contributor Author

@vandonr vandonr Jan 2, 2025

Choose a reason for hiding this comment

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

okay, inlining is not too easy to do using our current tooling though, because the callback to apply changes to files only looks at files one by one...

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.

This is a lot of extra code... do we need it all? How much does it increase the binary sizes (especially when multiplied by 4). Do we need it in all TFMs? Can we strip any of it out?

@vandonr
Copy link
Contributor Author

vandonr commented Dec 31, 2024

no we probably don't need everything. I'm only going to use it to build the object representing the schema, and then serialize it to json.
I'll look into stripping this down, but the vendoring tool is broken on mac, which doesn't help my case :p

In Java, it was reimplemented manually. That's an option too, but I wanted to use existing code as much as possible.

@vandonr
Copy link
Contributor Author

vandonr commented Jan 2, 2025

it's relatively hard to strip it by entire files. I did my best, but stripping more would require editing the code to remove references elsewhere, which would be quite a pain (like, there is a visitor referencing every model, and OpenApiDocument has a field for each document type for instance, removing a single Model that we don't use would require editing those two).

If it's still too big, I can write the objects and json serialization myself too, but that's risks of bugs && time spent not doing something else.

@vandonr vandonr merged commit 5393598 into master Jan 14, 2025
122 of 124 checks passed
@vandonr vandonr deleted the vandonr/vendored branch January 14, 2025 10:41
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 14, 2025
@andrewlock andrewlock added the area:vendors Code from other vendors label Jan 22, 2025
chojomok pushed a commit that referenced this pull request Jul 15, 2025
## Summary of changes

added the code of Microsoft.OpenApi to the tracer, removed/changed the
parts that require more recent versions of the language/fwk than we
have, and updated generated files.

## Reason for change

It's going to be needed for the protobuf instrumentation in #6166, and
I'm doing it in a separate PR to limit the size of the diff in the
actual change.

## Implementation details

@bouwkast ran the vendoring tool to add the files, since it's not
working on Mac apparently

## Test coverage

## Other details

When looking at the size of artefacts published on the CI, it looks like
this is increasing the size of the dll by ~180KiB

<!-- ⚠️ 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. -->

---------

Co-authored-by: Steven Bouwkamp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:vendors Code from other vendors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants