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

Conversation

msailes
Copy link
Contributor

@msailes msailes commented Dec 1, 2021

Issue #, if available:
#289

Description of changes:
Adding GraalVM native-image config

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

Codecov Report

Merging #311 (48360d2) into master (7e93511) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #311      +/-   ##
============================================
- Coverage     58.92%   58.90%   -0.02%     
+ Complexity     1206     1205       -1     
============================================
  Files           131      131              
  Lines          5066     5066              
  Branches        593      593              
============================================
- Hits           2985     2984       -1     
  Misses         1806     1806              
- Partials        275      276       +1     
Impacted Files Coverage Δ
.../java/com/amazonaws/xray/entities/SegmentImpl.java 87.34% <0.00%> (-3.80%) ⬇️
...ava/com/amazonaws/xray/AWSXRayRecorderBuilder.java 68.42% <0.00%> (-0.88%) ⬇️
...va/com/amazonaws/xray/entities/SubsegmentImpl.java 76.05% <0.00%> (+4.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e93511...48360d2. Read the comment docs.

Copy link
Contributor

@willarmiros willarmiros left a comment

Choose a reason for hiding this comment

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

The config looks good, just some questions since I'm unfamiliar with graalvm

{
"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 :)

"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.

"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.

@willarmiros willarmiros merged commit f4bc1e7 into aws:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants