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. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
In Java Agent, we already have
witnessClasses
andwitnessMethods
, 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 awitnessVersion
to 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 protectionDomain
in the method parameters of transform, we can get the target jar info throughgetCodeSource().getLocation()
.META-INF/maven/../pom.properties
through groupId, artifactId (higher priority)Implementation-Version
throughManifest
Are you willing to submit a pull request to implement this on your own?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions