Open eerhardt opened 1 month ago
@eerhardt - OTLP exporter part is WIP https://github.com/open-telemetry/opentelemetry-dotnet/pull/5731
@rajkumar-rangaraj will continue/take-over the WIP PR to make this in 1.10
Can be closed as duplicate of https://github.com/open-telemetry/opentelemetry-dotnet/issues/5730 as 5730 will remove the dependency on protobuf, and that'll indirectly fix this issue too.
Can be closed as duplicate of #5730 as 5730 will remove the dependency on protobuf, and that'll indirectly fix this issue too.
What about any other size issues beyond protobuf? For example, the Regex dependency I listed above.
Re-opening as there are other things beyond protobuf that needs a revisit. Removing 1.10 milestone as only protobuf is planned to be addressed for 1.10
So if that Regex is called often, it will slow down the app compared to a "normal" .NET app.
That particular one is not in hot path. Its only called when ActivitySource
is created, not for every Activity
creation.
That particular one is not in hot path. Its only called when ActivitySource is created, not for every Activity creation.
The size of the app isn't affected whether it is on the hot path or not.
That particular one is not in hot path. Its only called when ActivitySource is created, not for every Activity creation.
The size of the app isn't affected whether it is on the hot path or not.
That reply was only a response to the “slow down the app” part, not the size issue.
Package
OpenTelemetry
Package Version
Runtime Version
net9.0
Description
Adding OpenTelemetry to our native AOT'd ASP.NET Core "TodosApi" app in https://github.com/aspnet/Benchmarks/pull/2014 shows the app size increase from
18.1 MB
to22.2 MB
. About half of that size is from the OTLP Exporter. If I remove the OTLP Exporter, it drops back down to20.0 MB
.For loo
Steps to Reproduce
dotnet publish
the app before and after https://github.com/aspnet/Benchmarks/pull/2014. Measure the app size inbin\Release\net9.0\win-x64\publish
.Expected Result
The app size change should be as minimal as possible.
Actual Result
The app gets about 22% larger when enabling OTel.
Additional Context
Using https://github.com/MichalStrehovsky/sizoscope, you can get some insight into what is taking all the size.
The first thing that jumps out to me is the usage of Regex:
This is coming from
https://github.com/open-telemetry/opentelemetry-dotnet/blob/6ec151072910b024e0e47f7a87de25695a14a502/src/OpenTelemetry/Trace/TracerProviderSdk.cs#L254-L259
The unfortunate thing about this is not only app size, but also on native AOT'd apps, Regex's that don't use the source generator are always interpreted. So if that Regex is called often, it will slow down the app compared to a "normal" .NET app.
For the OTLP Exporter, it looks like most of the app size is coming from Grpc:
and from generic collections of structs: