Skip to content

Make it possible to ignore existing native configuration with the native tracing agent #3283

Closed
@sdeleuze

Description

@sdeleuze
Collaborator

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

modified the milestone: 20.3 on Mar 16, 2021
added this to the 21.2 milestone on Apr 8, 2021
aclement

aclement commented on Apr 9, 2021

@aclement

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:

  • it discovers META-INF/native-image entries on the classpath (in directories, don't think it goes into jars yet)
  • loads them up into a separate configurationset
  • subtracts that configurationset from the collected set before it is written out (possible to do this as you go I suppose, I just did something quick).
  • it attempts to simplify entries in the agent output as much as possible, so it is quite granular, it doesn't just remove them if they are identical, it strips them down (for example if the existing config named 3 methods and the computed config contained 5, it should remove 3 from the computed config)

For our webmvc-tomcat sample, I saw the line count for reflect-config.json go from 2800 to 1900.

modified the milestones: 21.2, 21.3 on Jun 15, 2021
gradinac

gradinac commented on Jun 23, 2021

@gradinac
Contributor

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 JARs
  • config-to-omit=<path> omits configuration from a specified directory

This 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

gradinac commented on Sep 22, 2021

@gradinac
Contributor

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

sdeleuze commented on Nov 25, 2021

@sdeleuze
CollaboratorAuthor
jtjeferreira

jtjeferreira commented on Oct 20, 2023

@jtjeferreira

Is there any work planned to improve the filtering as per @sdeleuze comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sdeleuze@aclement@vjovanov@jtjeferreira@gradinac

      Issue actions

        Make it possible to ignore existing native configuration with the native tracing agent · Issue #3283 · oracle/graal