-
Notifications
You must be signed in to change notification settings - Fork 764
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
Adding OpenTelemetry to a native AOT app adds a lot of app size #5785
Comments
@rajkumar-rangaraj will continue/take-over the WIP PR to make this in 1.10 |
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. |
That particular one is not in hot path. Its only called when |
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 aspnet/Benchmarks#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 aspnet/Benchmarks#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
opentelemetry-dotnet/src/OpenTelemetry/Trace/TracerProviderSdk.cs
Lines 254 to 259 in 6ec1510
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:
The text was updated successfully, but these errors were encountered: