Skip to content
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

Merged
merged 3 commits into from
Mar 31, 2022

Conversation

mateuszrzeszutek
Copy link
Member

… name

Extracted part of #5692

@mateuszrzeszutek mateuszrzeszutek requested a review from a team as a code owner March 29, 2022 13:34
Comment on lines -64 to -69
extensions.addAll(
parseLocation(
System.getProperty(
"otel.javaagent.experimental.initializer.jar",
System.getenv("OTEL_JAVAAGENT_EXPERIMENTAL_INITIALIZER_JAR")),
javaagentFile));
Copy link
Member Author

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.

Comment on lines +36 to +38
resourceUrls.size() == 2
resourceUrls.get(0).openStream().text.trim() == 'Hello world!'
resourceUrls.get(1).openStream().text.trim() == 'Hello there'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines 179 to 183
URL resource = helpersSource.getResource(helperResource.getAgentPath());
if (resource == null) {
Enumeration<URL> resources;
try {
resources = helpersSource.getResources(helperResource.getAgentPath());
} catch (IOException e) {
Copy link
Member

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

Copy link
Member Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(just kidding 😄)

Suggested change
for (URL r : haystack) {
for (URL hayOrNeedle : haystack) {

@mateuszrzeszutek mateuszrzeszutek merged commit 7bc748a into open-telemetry:main Mar 31, 2022
@mateuszrzeszutek mateuszrzeszutek deleted the multi-resource branch March 31, 2022 09:51
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants