-
Notifications
You must be signed in to change notification settings - Fork 288
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
[Instrumentation.AWSLambda] Fix AoT warnings #1544
[Instrumentation.AWSLambda] Fix AoT warnings #1544
Conversation
src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSMessagingUtils.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1544 +/- ##
==========================================
+ Coverage 73.91% 80.70% +6.78%
==========================================
Files 267 113 -154
Lines 9615 3073 -6542
==========================================
- Hits 7107 2480 -4627
+ Misses 2508 593 -1915
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@normj Do you have any insight into the deserialization of the payload here being right in the context of the changes here to use the source generator? |
@martincostello There is a unit test with an example payload here: Lines 62 to 101 in 8a89a69
If that test passes, the deserialization should actually be good, but feel free to double-check |
src/OpenTelemetry.Instrumentation.AWSLambda/AWSLambdaWrapper.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaUtils.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaUtils.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.AWSLambda/OpenTelemetry.Instrumentation.AWSLambda.csproj
Outdated
Show resolved
Hide resolved
Sorry I'm not understanding the question. Are you asking if the |
Yep, that was the question. Thanks for the feedback both, I'll address these today. |
src/OpenTelemetry.Instrumentation.AWSLambda/AWSLambdaWrapper.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaResourceDetector.cs
Outdated
Show resolved
Hide resolved
<PackageReference Include="Amazon.Lambda.SNSEvents" Version="2.0.0" /> | ||
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="2.1.0" /> | ||
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.0" /> | ||
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is raising the lower bound of these dependencies necessary? In particular this one from major version 1 to 2? After all, these define which versions we can instrument. If so, please add a changelog entry (Sth like: Amazon Lambda package Versions below 2.1 no longer supported, see package dependencies for details)
(Or maybe this dependency was even already overridden by a transitive dependency through another Amazon.Lambda.* dependency where we were already using 2.x?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These versions all correlate to the versions that first introduced support for native AoT: CHANGELOG.
Version 2.1.0 of Amazon.Lambda.Core is the first version that added explicit support for net6.0
, which was required by the changes asked for in #1545, and the only release since then was the 2.2.0 release for net8.0
support that resolves the native AoT warnings.
Based on that, I think these are reasonable increases to require of users while also making this assembly usable without trim warnings in native AoT applications. There were also already breaking changes listed in the CHANGELOG for this library before this PR or #1545.
Thoughts @normj?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while also making this assembly usable without trim warnings in native AoT applications
I wonder, because I assume the following:
- Users of the instrumentation should still have their own dependencies on Lambda packages and not rely on transitive dependencies here (unfortunately no implementation/api distinction exists in Nuget like in Java Gradle modules)
- If users want AoT or trimming, they can & should upgrade their own dependencies as needed. The library we release only specifies a lower bound.
Based on what you write with the .NET 6 support, an upgrade to 2.1 is totally reasonable without question, but I wonder about 2.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can downgrade it a bit in my native AoT Lambda using .NET 8 and see if I get any IL warnings (martincostello/alexa-london-travel#1020) or not.
My library does already specify its own dependencies for the Lambda assemblies it needs, but I don't use API Gateway, SNS or SQS, but I get all of those dependencies via this library transiently. Needing the end-user to manually upgrade the transient dependencies to get it to work properly for native AoT isn't ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I don't use API Gateway, SNS or SQS, but I get all of those dependencies via this library transiently
Good point. This is not ideal anyway. I don't think there is a way to have these as compile-only dependencies and then check at runtime if they are actually present? (But this of course goes way beyond the scope of this PR anyways)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Norm might know some tricks for dealing with that as the core AWS SDKs have to do similar things for things like STS authentication via the built-in fallback credential providers, but yeah that's a bit of a spiral out of the original scope here 😅.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I can't think of any special tricks here. The only difference between 2.1 and 2.2 for Amazon.Lambda.Core is updates to the project file to have the .NET 8 target and mark the package trimmable for .NET 8 if that makes you feel better taking the updated dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a non-component owner the changes look good.
Make OpenTelemetry.Instrumentation.AWSLambda AoT compatible by using System.Text.Json instead of Newtonsoft.Json and updating to Amazon.Lambda packages that support native AoT.
There is a conflict between `OpenTelemetry.Extensions.AWS` and the dependency `OpenTelemetry.ResourceDetectors.AWS` has on it from NuGet, rather than from source.
good to see this is closed ... |
Changes
Make OpenTelemetry.Instrumentation.AWSLambda AoT compatible by:
CHANGELOG.md
updated for non-trivial changes