-
Notifications
You must be signed in to change notification settings - Fork 283
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
[Exporter.Geneva] Resolve AOT warnings in OpenTelemetry.Exporter.Geneva #1666
[Exporter.Geneva] Resolve AOT warnings in OpenTelemetry.Exporter.Geneva #1666
Conversation
- Also use Regex source generator for faster startup, less memory usage, and the ability to trim the Regex engine.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1666 +/- ##
==========================================
+ Coverage 73.91% 74.28% +0.36%
==========================================
Files 267 264 -3
Lines 9615 9977 +362
==========================================
+ Hits 7107 7411 +304
- Misses 2508 2566 +58
Flags with carried forward coverage won't be shown. Click here to find out more.
|
src/OpenTelemetry.Exporter.Geneva/Metrics/Transport/MetricEtwDataTransport.cs
Show resolved
Hide resolved
@eerhardt GenevaExporter also uses opentelemetry-dotnet-contrib/src/OpenTelemetry.Exporter.Geneva/Internal/ReentrantExportProcessor.cs Lines 18 to 25 in ab7bdab
|
There wasn't an AOT warning for it, which means that it will work correctly when AOT'd. Linq Expressions do work with trimming and AOT, as long as the tooling can statically tell what methods/properties/etc you are referencing. In this case, it can since the types are all static - The drawback to using Linq Expressions on native AOT'd apps is that the "compiled" expression is just compiled into an expression tree and the tree is interpreted every time it is executed. So it is a slower than it would be on a normal CoreCLR process where it can be compiled to IL and JIT'd to machine code. If this is a problem, I would recommend making the constructor of |
Thanks @eerhardt for the explanation! We would have to switch to using pure Reflection on Native AOT but that can be address later. For now, this PR looks good. |
"have to" is too strong of a phrase. The code as is will work on Native AOT. My recommendation would be to not use private/internal Reflection at all. If this API is supposed to be called outside of the assembly, it should be public. Or if this code is supposed to be removed, we should do the work to remove it. |
Ah yes! Pardon my English 😀. What I actually wanted to say was we could "consider" switching to pure reflection. We don't have to unless there is a valid complaint/ user ask for it.
Unfortunately, both of those alternatives are probably going to be hard (time-taking) as the private API is coming from the main package which has stricter requirements for making things public. Maybe it's time to revisit this issue in the main repo. |
One other reason to use pure Reflection (besides potential throughput gains) would be for size. If this is the only code in the app pulling in Linq Expressions, there is potential size savings with trimming Linq Expressions from this code. I can look to see if that's the case for the case I care about. |
Changes
Make OpenTelemetry.Exporter.Geneva compatible with native AOT.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes