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

Support testing library/agent instrumentation interoperability #4771

Merged

Conversation

trask
Copy link
Member

@trask trask commented Dec 1, 2021

I don't think the removed code is needed anymore since the library instrumentation is shaded inside of the agent even during tests now. But let's see what CI says...

Removing this code will allow agent tests to be written that use the library instrumentation and verify interoperability between the two.

@anuraaga
Copy link
Contributor

anuraaga commented Dec 2, 2021

@trask Looks like CI might not like this PR, but also the tests not catching #4718 makes me think that either an improvement or alternative to this snippet is still needed

@trask trask force-pushed the testing-library-agent-instrumentation-interop branch 2 times, most recently from 56408fa to b083079 Compare December 2, 2021 01:59
@trask trask force-pushed the testing-library-agent-instrumentation-interop branch from b083079 to e24eb12 Compare December 2, 2021 04:24
@anuraaga
Copy link
Contributor

anuraaga commented Dec 2, 2021

@trask Thanks for looking at this :) By the way, the idea I had in mind to remove this snippet and make things hopefully more robust is a custom configuration type for instrumentation dependencies we bundle. We currently have library, which is like compileOnly + testImplementation (with the ability to raise the version number to latest), we could have a bundled which is like compileOnly + shadowInclude (semantically, we don't shade each individual project so this configuration would need to be recognized at the bundle site). And this would then make sure the files aren't in the test classpath in a more Gradle-native way than my hack around our current usage of implementation

@trask
Copy link
Member Author

trask commented Dec 2, 2021

the idea I had in mind to remove this snippet and make things hopefully more robust is a custom configuration type for instrumentation dependencies we bundle. We currently have library, which is like compileOnly + testImplementation (with the ability to raise the version number to latest), we could have a bundled which is like compileOnly + shadowInclude (semantically, we don't shade each individual project so this configuration would need to be recognized at the bundle site). And this would then make sure the files aren't in the test classpath in a more Gradle-native way than my hack around our current usage of implementation

This sounds cool, though I'll probably leave this part for the gradle magicians ✨

I think I've about worked out what should / should not be on the class path in order to enable writing tests that verify interoperability between agent and library instrumentation (see also #4779).

@trask
Copy link
Member Author

trask commented Dec 2, 2021

CI still hasn't passed yet, but I'm feeling good about this next run, so optimistically marking it ready for review 😂

if (lib.startsWith(instrumentationDir) &&
lib.extension == "jar" &&
!lib.absolutePath.substring(instrumentationDir.absolutePath.length).contains("testing")) {
if (lib.name.startsWith("opentelemetry-javaagent-")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If lib is an absoluteFile, how can it start with opentelemetry-javaagent?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's lib.name, e.g. File.getName(), not the full path

@trask trask merged commit 2ba893e into open-telemetry:main Dec 2, 2021
@trask trask deleted the testing-library-agent-instrumentation-interop branch December 2, 2021 18:12
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
…telemetry#4771)

* Support testing library/agent instrumentation interoperability

* Exclude autoconfigure modules also

* Not just any autoconfigure
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

4 participants