Skip to content

Conversation

zacharycmontoya
Copy link
Contributor

Summary of changes

Vendors the following libraries into Datadog.Trace.dll:

  • Google.Protobuf => vendored to the namespace Datadog.Trace.Vendors.Google.Protobuf
  • opentelemetry-proto => The .proto files that define the OTLP protocol are stored in tracer/src/Datadog.Trace/Vendors/protos/**/*.proto

This also updates the UpdateVendoredCode Nuke build target to download the Grpc.Tools NuGet package and compile the .proto files into C# code, and the resulting files are stored as tracer/src/Datadog.Trace/OpenTelemetry/Proto/**/*.g.cs

Reason for change

We currently must produce protobuf for the OTel Metris API feature (http/protobuf), so vendoring Google.Protobuf and the opentelemetry-proto repo makes our protobuf generation maintainable. Also, as we look to add a grpc OTLP exporter, we may need to use Google.Protobuf and some of the Grpc libraries. This at least starts the process of adding the requisite libraries.

Implementation details

  • Vendors Google.Protobuf and the opentelemetry-proto repositories
  • Adds the required file replacements for Google.Protobuf to build correctly
  • Updates the UpdateVendoredCode Nuke target to also run the protobuf compiler to convert the .proto files to corresponding .g.cs files

Test coverage

Locally, I've measured the following Datadog.Trace.dll size differences:

Framework Size Before (KB) Size After (KB) Absolute Diff (KB) Percent Diff
net6.0 8037 8775 738 9.18%
net461 8181 8917 736 9.00%
netcoreapp3.1 7961 8698 737 9.26%
netstandard2.0 7991 8728 737 9.22%

I haven't done any tests to identify startup costs.

Other details

…o files

Adds feature to UpdateVendors to customize the destination path of the vendored source code with a PathToDestination property
Note: This does not replace the base namespace of the vendored Google.Protobuf code so that we can import the Grpc.Tools NuGet package at build time to generate the C# Protobuf classes. In a separate commit we can try to rename the namespace and generate the C# Protobuf files ahead-of-time.
…dateVendors call. The files will now be persisted in the source tree
@github-actions github-actions bot added the area:builds project files, build scripts, pipelines, versioning, releases, packages label Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:builds project files, build scripts, pipelines, versioning, releases, packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant