-
Notifications
You must be signed in to change notification settings - Fork 358
Closed
open-telemetry/opentelemetry-dotnet
#5642Labels
comp:exporter.genevaThings related to OpenTelemetry.Exporter.GenevaThings related to OpenTelemetry.Exporter.GenevaenhancementNew feature or requestNew feature or request
Milestone
Description
When using the GenevaExporter in a native AOT application, it is bringing in System.Linq.Expressions, which adds size to the app, but also any Linq.Expressions are interpreted at runtime (since IL can't be generated).
See the following:
@eerhardt GenevaExporter also uses `Expression.Lambda` from [System.Linq.Expressions](https://learn.microsoft.com/en-us/dotnet/api/system.linq.expressions?view=net-8.0). Did we not have a Trim/AOT issue when using that?
opentelemetry-dotnet-contrib/src/OpenTelemetry.Exporter.Geneva/Internal/ReentrantExportProcessor.cs
Lines 18 to 25 in ab7bdab
| static ReentrantExportProcessor() | |
| { | |
| var flags = BindingFlags.Instance | BindingFlags.NonPublic; | |
| var ctor = typeof(Batch<T>).GetConstructor(flags, null, new Type[] { typeof(T) }, null); | |
| var value = Expression.Parameter(typeof(T), null); | |
| var lambda = Expression.Lambda<Func<T, Batch<T>>>(Expression.New(ctor, value), value); | |
| CreateBatch = lambda.Compile(); | |
| } |
Originally posted by @utpilla in #1666 (comment)
We should decide how to fix this. Options I see are:
- Make
Batch<T>(T item)ctor public, and GenevaExporter can just call it. - Use Reflection directly when
RuntimeFeature.IsDynamicCodeCompiledisfalse. - Address this comment in the code and make this class go away:
opentelemetry-dotnet-contrib/src/OpenTelemetry.Exporter.Geneva/Internal/ReentrantExportProcessor.cs
Lines 10 to 15 in ab7bdab
| // This export processor exports without synchronization. | |
| // Once OpenTelemetry .NET officially support this, | |
| // we can get rid of this class. | |
| // This is currently only used in ETW export, where we know | |
| // that the underlying system is safe under concurrent calls. | |
| internal class ReentrantExportProcessor<T> : BaseExportProcessor<T> |
Metadata
Metadata
Assignees
Labels
comp:exporter.genevaThings related to OpenTelemetry.Exporter.GenevaThings related to OpenTelemetry.Exporter.GenevaenhancementNew feature or requestNew feature or request