-
Notifications
You must be signed in to change notification settings - Fork 484
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
Instrumentations support Java extensions #2761
Instrumentations support Java extensions #2761
Conversation
|
||
// Extensions defines java specific extensions. | ||
// +optional | ||
Extensions *Extensions `json:"extensions,omitempty"` |
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 would prefer if this would be a list.
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.
You are right; this makes it easier to integrate some third-party extensions.
|
||
type Extensions struct { | ||
// Image is a container image with extensions auto-instrumentation JAR. | ||
Image string `json:"image"` |
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.
Does the extension needs to be rebuild for every java agent version?
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 it's necessary; the user just needs to package based on the javaagent version he's using.
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.
For some open source extensions, maybe it should provide a compatibility list for javaagent.
Please add a changelog for this |
Done, PTAL |
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.
LGTM, we just need to figure out how to avoid overriding of the extensions
@@ -45,6 +46,11 @@ func injectJavaagent(javaSpec v1alpha1.Java, pod corev1.Pod, index int) (corev1. | |||
} | |||
} | |||
|
|||
javaJVMArgument := javaAgent | |||
if len(javaSpec.Extensions) > 0 { | |||
javaJVMArgument = javaAgent + fmt.Sprintf(" -Dotel.javaagent.extensions=%s/extensions", javaInstrMountPath) |
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.
https://opentelemetry.io/docs/languages/java/automatic/configuration/#extensions
If all extensions are copied to the same directory it can cause overrides.
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.
Sorry, I'm not sure what the confusion is here.
I think the user should make sure that the jars in the /extensions
directory are unique, even if he doesn't use the operator.
@crossoverJie the basic checks failed. You probably need to regenerate manifests |
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.
LGTM just some documentation nits
.chloggen/support-extensions.yaml
Outdated
component: auto-instrumentation | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Instrumentations support Java extensions |
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.
nit: Support Java auto-instrumentation extensions.
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.
Done.
@@ -133,6 +133,18 @@ type Java struct { | |||
// Resources describes the compute resource requirements. | |||
// +optional | |||
Resources corev1.ResourceRequirements `json:"resources,omitempty"` | |||
|
|||
// Extensions defines java specific extensions. |
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.
@crossoverJie all extensions are copied to a single directory, therefore we should document it because one extension can override another one.
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 have added related documents.
* Support extensions * fix with cr * fix document * fix lint
* Support extensions * fix with cr * fix document * fix lint
Description:
Operator will copy jars from the
${java.extensions}
directory to/otel-auto-instrumentation/extensions
.JVM parameters will also be added to the
JAVA_TOOL_OPTIONS
environment variable:-Dotel.javaagent.extensions=/otel-auto-instrumentation-java/extensions.
Link to tracking Issue(s):
Testing: https://github.com/crossoverJie/opentelemetry-operator/blob/6727627c897d89ecdc93718f4a8417a0d69a1c48/pkg/instrumentation/javaagent_test.go#L89
Documentation: Later.