awslabs / disco

A suite of tools including a framework for creating Java Agents, for aspect-oriented tooling for distributed systems.
Apache License 2.0
58 stars 12 forks source link

Added new Bootstrap classpath loading strategy for DiscoAgent #11

Closed willarmiros closed 4 years ago

willarmiros commented 4 years ago

Description of changes: I removed the Boot-Class-Path attribute from the disco-java-agent's manifest, and introduced a new Bootstrap injection strategy for the substrate DiscoAgent to replace it. The new approach is inspired directly from the OpenTelemetry Java Agent, and in short it uses a minimal agent class DiscoAgent, as the premain class. DiscoAgent then adds the entire disco-java-agent.jar file to the bootstrap classpath, as was done before, then jumps over to the original agent class (now DiscoBootstrapAgent) to perform the expected work.

I need to add some more JavaDoc and update the readme, but I chiefly wanted to make sure this strategy was acceptable before polishing it off. I think removing the jar name from the manifest will save much pain down the road.

Also removed some redundancy from Disco agent's build.gradle and fixed a StringIndexOutOfBoundsException that happened if there's a directory in your pluginPath.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

willarmiros commented 4 years ago

Closing this since we're not taking this approach for now. A similar strategy may be adopted in the future, but needs to be a solution developed for DiSCo with more thorough testing.