Description
One simple but very useful feature would be to allow to ignore existing native configuration with the tracing agent. For example, the agent could be aware of the configuration in META-INF/native-image/*.json
in the project and generate only what is not already present in this existing configuration.
A very interesting use case would be with Spring Native that generates all the configuration it can using an analysis of the Spring application via the Spring AOT build plugins. Currently even with all that inferred configuration, if just a few entries were missing, they are totally lost in the huge configuration files generated by the agent.
This enhancement would allow the tracing agent to just generate "the useful diff" that could then be taken and used as it is or converted to Spring @NativeHint
. We think that feature would be useful outside of Spring as well.
I would be in favor of that being the default behavior. If that's not possible or if you consider that's not a good idea, providing a configuration flag on the agent would be fine.
Activity
aclement commentedon Apr 9, 2021
I'll just mention I did some experiments around this in a branch of mine:
https://github.com/aclement/graal/tree/agent-filtering
It's a bit unfinished but the principles are there:
For our webmvc-tomcat sample, I saw the line count for reflect-config.json go from 2800 to 1900.
gradinac commentedon Jun 23, 2021
Hey @aclement! Your approach for this change is good, and the principles it follows (filtering configuration when it's written out and simplifying entries) is basically the same as it's now implemented on master: a461aa0
There are two different agent flags related to this mode:
experimental-omit-config-from-classpath
omits configuration present on the classpath, both in directories and JARsconfig-to-omit=<path>
omits configuration from a specified directoryThis feature won't be in the upcoming 21.2 release, but it's on master and should soon be available in the dev builds. If anyone has a chance to test it out - please do and let me if it works for you
gradinac commentedon Sep 22, 2021
I'll close this issue as the feature had made it into 21.3 - let me know if you hit any issues/have any questions about the feature
sdeleuze commentedon Nov 25, 2021
FYI spring-attic/spring-native#617 (comment)
jtjeferreira commentedon Oct 20, 2023
Is there any work planned to improve the filtering as per @sdeleuze comment?