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

Automatic instrumentation of Java agent overrides JAVA_TOOL_OPTIONS #2080

Closed
thomaspaulin opened this issue Sep 4, 2023 · 4 comments
Closed

Comments

@thomaspaulin
Copy link

The Docker image I'm using uses java -jar as its ENTRYPOINT such that the final CMD expects a jar file. In order to configure the JVM I'm passing values to JAVA_TOOL_OPTIONS, but Otel overrides these with the -javaagent per comments #1744 and #1135. Is there a way to combine the existing options with those Otel injects? From the issues on this repository (#1814 and #1393) it seems that's not yet the case.

@iblancasa
Copy link
Contributor

How are you setting it? Directly as an environment variable or using a ConfigMap?

@thomaspaulin
Copy link
Author

thomaspaulin commented Sep 5, 2023

Directly as an environment variable in the Dockerfile, then it's being overridden by the environment variables of the Deployment

@iblancasa
Copy link
Contributor

The operator just takes into account the Kubernetes configuration.
https://github.com/open-telemetry/opentelemetry-operator/blob/main/pkg/instrumentation/javaagent.go#L45-L53

It cannot check what is inside the container image.

@thomaspaulin
Copy link
Author

Turns out the JAVA_TOOL_OPTIONS environment variable was set only in the Dockerfile, and not in the Deployment resource. If I set it on the deployment it merges with the Open Telemetry agent as expected. As such I'll close this issue.

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

No branches or pull requests

2 participants