-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to register multiple helper resources under the same… #5703
Make it possible to register multiple helper resources under the same… #5703
Conversation
conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts
Outdated
Show resolved
Hide resolved
extensions.addAll( | ||
parseLocation( | ||
System.getProperty( | ||
"otel.javaagent.experimental.initializer.jar", | ||
System.getenv("OTEL_JAVAAGENT_EXPERIMENTAL_INITIALIZER_JAR")), | ||
javaagentFile)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property is already handled by the AgentClassLoader
-- the jar it points to end up being added directly to the agent CL. Loading it as an extension just adds another copy of these classes.
resourceUrls.size() == 2 | ||
resourceUrls.get(0).openStream().text.trim() == 'Hello world!' | ||
resourceUrls.get(1).openStream().text.trim() == 'Hello there' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
URL resource = helpersSource.getResource(helperResource.getAgentPath()); | ||
if (resource == null) { | ||
Enumeration<URL> resources; | ||
try { | ||
resources = helpersSource.getResources(helperResource.getAgentPath()); | ||
} catch (IOException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I've ever noticed that getResources
throws IOException but getResource
doesn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was surprised by that too
} | ||
|
||
private static boolean containsSameFile(List<URL> haystack, URL needle) { | ||
for (URL r : haystack) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(just kidding 😄)
for (URL r : haystack) { | |
for (URL hayOrNeedle : haystack) { |
javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/HelperResources.java
Outdated
Show resolved
Hide resolved
javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/HelperResources.java
Outdated
Show resolved
Hide resolved
open-telemetry#5703) * Make it possible to register multiple helper resources under the same name * go back to using the old property in tests after all * code review comments
… name
Extracted part of #5692