Adding Version Constraints for Target Libraries in Java Agent Instrumentation #13036
CodePrometheus
started this conversation in
Ideas
Replies: 1 comment
|
I think the key question is, why? Which scenario will require this? Because the version is something more random by the developers, what is the reason we need to trust that? The version number level backward compatibility usually means from user APIs and API usage perspective, but the agent focuses on the core codes. They are different. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
In Java Agent, we already have
witnessClassesandwitnessMethods, which can play a limiting role when the target may have multiple versions. From the perspective of plugin developers, these operations may be more expensive or not simple enough (I think) than directly determining the version, so I want to add awitnessVersionto directly limit the target libraries version.For example, I can apply the following restrictions to pulsar-client (version 4.x):
The implementation plan is as follows:
Using the
ProtectionDomain protectionDomainin the method parameters of transform, we can get the target jar info throughgetCodeSource().getLocation().META-INF/maven/../pom.propertiesthrough groupId, artifactId (higher priority)Implementation-VersionthroughManifestAre you willing to submit a pull request to implement this on your own?
Code of Conduct
All reactions