Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dd-java-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@ tasks.register('verifyAgentJarIntegrations', JavaExec) {
classpath = objects.fileCollection().from(jarProvider)
args = ['--list-integrations']

// Listing integrations only inspects classes and metadata in the assembled agent jar, so it does
// not need inherited JAVA_TOOL_OPTIONS.
environment.remove('JAVA_TOOL_OPTIONS')
Comment on lines +625 to +627

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can follow this way as a fix (and maybe even keep it).
As alternative solution we may probably need to make check logic more robust.
like add some sort of begin marker and end marker and analyze output between markers.

I just executed locally:
java -jar dd-java-agent/build/libs/dd-java-agent-1.65.0-SNAPSHOT.jar --list-integrations
and got the output:

IastInstrumentation
aerospike
akka-http
....
zio.experimental

So as possible improvements we can generate something like:
java -jar dd-java-agent/build/libs/dd-java-agent-1.65.0-SNAPSHOT.jar --list-integrations --with-marker

List of dd-trace-java integrations:
==============
IastInstrumentation
aerospike
akka-http
....
zio.experimental
===============

This is just my idea and this solution will require more work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@AlexeyKuznetsov-DD I'm not sure it's worth introducing this option in the tracer. I.e. I don't see how it would benefit other usages.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Q: Does this remove the ENV from this Gradle task only? Meaning this would not affect other tasks running as part of the same build which may require JAVA_TOOL_OPTIONS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes - JAVA_TOOLS_OPTIONS is removed only from the child JVM of the verifyAgentJarIntegrations Gradle task!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

note: There are another special env var JDK_JAVA_OPTIONS that offer a similar feature (albeit with some restrictions). (Ignoring the undocumented, internal hotspot specific _JAVA_OPTIONS).

That said, I'm not sure this is worth a follow-up at this time.


// Capture both stdout and stderr: InstrumenterIndex.buildModule() logs ERROR and returns null when a module
// fails to load, while the process exits with status 0.
def capturedOutput = new ByteArrayOutputStream()
Expand Down
Loading