Skip to content
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

Issue: 289 - Adding GraalVM native-image support. #311

Merged
merged 1 commit into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"name": "com.amazonaws.xray.handlers.config.AWSServiceHandlerManifest",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.handlers.config.AWSOperationHandlerManifest",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.handlers.config.AWSOperationHandler",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.handlers.config.AWSOperationHandlerRequestDescriptor",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.handlers.config.AWSOperationHandlerResponseDescriptor",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[
{
"name": "com.amazonaws.xray.AWSXRay",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.strategy.sampling.manifest.SamplingRuleManifest",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.strategy.sampling.rule.SamplingRule",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same question here that @anuraaga had in the original issue, to quote him:

My understanding is graal would only need these for code that is accessed through reflection. I understand many of the classes are because Jackson accesses the fields reflectively, but there seem to be some like "name": "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir", and friends that don't. Do you know if these should be included?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just check I understand the question. Do you believe that this is never accessed via reflection? and isn't required?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is my understanding, but I could be wrong. I guess the author of these configs probably listed all these classes based on experimentation. If that's the case, then it's fine, just. interesting that some part of this logic (probably via Jackson) ends up accessing this class reflectively.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the config with this project https://github.com/aws-samples/serverless-graalvm-demo/tree/aws-xray-support and it was successful. That doesn't mean it isn't a false positive. I'll test it tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, if removing them causes your test to fail then it's fine to leave as-is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failed without.

"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir$MaxFunction",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter that these static nested classes are package-private?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they have to be added individually.

"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir$LessThan10",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.strategy.sampling.reservoir.Reservoir$AtLeast10",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.auth.AWS4Signer",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.entities.ThrowableDescription",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.entities.SubsegmentImpl",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.entities.EntityImpl",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.entities.TraceID",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.entities.Cause",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.xray.entities.SegmentImpl",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.fasterxml.jackson.databind.ser.std.ToStringSerializer",
"allPublicMethods": true,
"allPublicConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"resources" : {
"includes" : [ {
"pattern" : "\\Qcom/amazonaws/xray/interceptors/DefaultOperationParameterWhitelist.json\\E"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do the Q and E mean? I assume just delimiters for beginning and ending the expression, just strange the usual regex characters aren't used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern attribute is a Java regexp that matches resource(s) to be included in the image from https://www.graalvm.org/reference-manual/native-image/Resources/

I imagine this was created using the tracing agent so might have an auto generated feel :)

}, {
"pattern" : "\\Qcom/amazonaws/xray/sdk.properties\\E"
}, {
"pattern" : "\\Qcom/amazonaws/xray/strategy/sampling/DefaultSamplingRules.json\\E"
}, {
"pattern" : "\\Qsoftware/amazon/awssdk/global/handlers/execution.interceptors\\E"
}, {
"pattern" : "\\Qsoftware/amazon/awssdk/services/s3/execution.interceptors\\E"
} ]
},
"bundles" : [ ]
}