From 6727627c897d89ecdc93718f4a8417a0d69a1c48 Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Thu, 14 Mar 2024 17:12:57 +0800 Subject: [PATCH 1/4] Support extensions --- apis/v1alpha1/instrumentation_types.go | 12 ++++ apis/v1alpha1/zz_generated.deepcopy.go | 20 ++++++ .../opentelemetry.io_instrumentations.yaml | 15 +++++ .../opentelemetry.io_instrumentations.yaml | 15 +++++ docs/api.md | 41 ++++++++++++ pkg/instrumentation/javaagent.go | 23 ++++++- pkg/instrumentation/javaagent_test.go | 66 ++++++++++++++++++- pkg/instrumentation/podmutator_test.go | 14 ++-- pkg/instrumentation/sdk_test.go | 2 +- 9 files changed, 197 insertions(+), 11 deletions(-) diff --git a/apis/v1alpha1/instrumentation_types.go b/apis/v1alpha1/instrumentation_types.go index 0f3abf4203..c87b96da77 100644 --- a/apis/v1alpha1/instrumentation_types.go +++ b/apis/v1alpha1/instrumentation_types.go @@ -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. + // +optional + Extensions *Extensions `json:"extensions,omitempty"` +} + +type Extensions struct { + // Image is a container image with extensions auto-instrumentation JAR. + Image string `json:"image"` + + // Dir is a directory with extensions auto-instrumentation JAR. + Dir string `json:"dir"` } // NodeJS defines NodeJS SDK and instrumentation configuration. diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 8db7c841b4..df792ba43e 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -167,6 +167,21 @@ func (in *Exporter) DeepCopy() *Exporter { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Extensions) DeepCopyInto(out *Extensions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Extensions. +func (in *Extensions) DeepCopy() *Extensions { + if in == nil { + return nil + } + out := new(Extensions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Go) DeepCopyInto(out *Go) { *out = *in @@ -357,6 +372,11 @@ func (in *Java) DeepCopyInto(out *Java) { } } in.Resources.DeepCopyInto(&out.Resources) + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = new(Extensions) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Java. diff --git a/bundle/manifests/opentelemetry.io_instrumentations.yaml b/bundle/manifests/opentelemetry.io_instrumentations.yaml index ef45bae209..7a779407db 100644 --- a/bundle/manifests/opentelemetry.io_instrumentations.yaml +++ b/bundle/manifests/opentelemetry.io_instrumentations.yaml @@ -919,6 +919,21 @@ spec: - name type: object type: array + extensions: + description: Extensions defines java specific extensions. + properties: + dir: + description: Dir is a directory with extensions auto-instrumentation + JAR. + type: string + image: + description: Image is a container image with extensions auto-instrumentation + JAR. + type: string + required: + - dir + - image + type: object image: description: Image is a container image with javaagent auto-instrumentation JAR. diff --git a/config/crd/bases/opentelemetry.io_instrumentations.yaml b/config/crd/bases/opentelemetry.io_instrumentations.yaml index 86a7ed0c47..34d9f959d2 100644 --- a/config/crd/bases/opentelemetry.io_instrumentations.yaml +++ b/config/crd/bases/opentelemetry.io_instrumentations.yaml @@ -917,6 +917,21 @@ spec: - name type: object type: array + extensions: + description: Extensions defines java specific extensions. + properties: + dir: + description: Dir is a directory with extensions auto-instrumentation + JAR. + type: string + image: + description: Image is a container image with extensions auto-instrumentation + JAR. + type: string + required: + - dir + - image + type: object image: description: Image is a container image with javaagent auto-instrumentation JAR. diff --git a/docs/api.md b/docs/api.md index 259cf829ea..f36e5f47ae 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1906,6 +1906,13 @@ Java defines configuration for java auto-instrumentation. Env defines java specific env vars.
false + + extensions + object + + Extensions defines java specific extensions.
+ + false image string @@ -2188,6 +2195,40 @@ TODO: Add other useful fields. apiVersion, kind, uid?
+### Instrumentation.spec.java.extensions +[↩ Parent](#instrumentationspecjava) + + + +Extensions defines java specific extensions. + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
dirstring + Dir is a directory with extensions auto-instrumentation JAR.
+
true
imagestring + Image is a container image with extensions auto-instrumentation JAR.
+
true
+ + ### Instrumentation.spec.java.resources [↩ Parent](#instrumentationspecjava) diff --git a/pkg/instrumentation/javaagent.go b/pkg/instrumentation/javaagent.go index 5422cc08ad..bd68c6035c 100644 --- a/pkg/instrumentation/javaagent.go +++ b/pkg/instrumentation/javaagent.go @@ -15,6 +15,8 @@ package instrumentation import ( + "fmt" + corev1 "k8s.io/api/core/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" @@ -22,7 +24,7 @@ import ( const ( envJavaToolsOptions = "JAVA_TOOL_OPTIONS" - javaJVMArgument = " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" + javaAgent = " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" javaInitContainerName = initContainerName + "-java" javaVolumeName = volumeName + "-java" javaInstrMountPath = "/otel-auto-instrumentation-java" @@ -45,6 +47,11 @@ func injectJavaagent(javaSpec v1alpha1.Java, pod corev1.Pod, index int) (corev1. } } + javaJVMArgument := javaAgent + if javaSpec.Extensions != nil { + javaJVMArgument = javaAgent + fmt.Sprintf(" -Dotel.javaagent.extensions=%s/extensions", javaInstrMountPath) + } + idx := getIndexOfEnv(container.Env, envJavaToolsOptions) if idx == -1 { container.Env = append(container.Env, corev1.EnvVar{ @@ -80,6 +87,20 @@ func injectJavaagent(javaSpec v1alpha1.Java, pod corev1.Pod, index int) (corev1. MountPath: javaInstrMountPath, }}, }) + + if javaSpec.Extensions != nil { + pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{ + Name: initContainerName + "-extensions", + Image: javaSpec.Extensions.Image, + Command: []string{"cp", "-r", javaSpec.Extensions.Dir, javaInstrMountPath + "/extensions"}, + Resources: javaSpec.Resources, + VolumeMounts: []corev1.VolumeMount{{ + Name: javaVolumeName, + MountPath: javaInstrMountPath, + }}, + }) + } + } return pod, err } diff --git a/pkg/instrumentation/javaagent_test.go b/pkg/instrumentation/javaagent_test.go index 3a8c43b84f..216c2dca51 100644 --- a/pkg/instrumentation/javaagent_test.go +++ b/pkg/instrumentation/javaagent_test.go @@ -76,7 +76,69 @@ func TestInjectJavaagent(t *testing.T) { Env: []corev1.EnvVar{ { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, + }, + }, + }, + }, + }, + }, + err: nil, + }, + { + name: "add extensions to JAVA_TOOL_OPTIONS", + Java: v1alpha1.Java{Image: "foo/bar:1", Extensions: &v1alpha1.Extensions{Image: "ex/ex:1", Dir: "/ex"}}, + pod: corev1.Pod{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + {}, + }, + }, + }, + expected: corev1.Pod{ + Spec: corev1.PodSpec{ + Volumes: []corev1.Volume{ + { + Name: "opentelemetry-auto-instrumentation-java", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{ + SizeLimit: &defaultVolumeLimitSize, + }, + }, + }, + }, + InitContainers: []corev1.Container{ + { + Name: "opentelemetry-auto-instrumentation-java", + Image: "foo/bar:1", + Command: []string{"cp", "/javaagent.jar", "/otel-auto-instrumentation-java/javaagent.jar"}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "opentelemetry-auto-instrumentation-java", + MountPath: "/otel-auto-instrumentation-java", + }}, + }, + { + Name: "opentelemetry-auto-instrumentation-extensions", + Image: "ex/ex:1", + Command: []string{"cp", "-r", "/ex", "/otel-auto-instrumentation-java/extensions"}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "opentelemetry-auto-instrumentation-java", + MountPath: "/otel-auto-instrumentation-java", + }}, + }, + }, + Containers: []corev1.Container{ + { + VolumeMounts: []corev1.VolumeMount{ + { + Name: "opentelemetry-auto-instrumentation-java", + MountPath: "/otel-auto-instrumentation-java", + }, + }, + Env: []corev1.EnvVar{ + { + Name: "JAVA_TOOL_OPTIONS", + Value: javaAgent + " -Dotel.javaagent.extensions=/otel-auto-instrumentation-java/extensions", }, }, }, @@ -137,7 +199,7 @@ func TestInjectJavaagent(t *testing.T) { Env: []corev1.EnvVar{ { Name: "JAVA_TOOL_OPTIONS", - Value: "-Dbaz=bar" + javaJVMArgument, + Value: "-Dbaz=bar" + javaAgent, }, }, }, diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index 917eff5764..745e6946d2 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -168,7 +168,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_TRACES_EXPORTER", @@ -356,7 +356,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_TRACES_EXPORTER", @@ -431,7 +431,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_TRACES_EXPORTER", @@ -3534,7 +3534,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_SERVICE_NAME", @@ -3581,7 +3581,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_SERVICE_NAME", @@ -4189,7 +4189,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_SERVICE_NAME", @@ -4236,7 +4236,7 @@ func TestMutatePod(t *testing.T) { }, { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_SERVICE_NAME", diff --git a/pkg/instrumentation/sdk_test.go b/pkg/instrumentation/sdk_test.go index a1024be110..e442b1a054 100644 --- a/pkg/instrumentation/sdk_test.go +++ b/pkg/instrumentation/sdk_test.go @@ -557,7 +557,7 @@ func TestInjectJava(t *testing.T) { Env: []corev1.EnvVar{ { Name: "JAVA_TOOL_OPTIONS", - Value: javaJVMArgument, + Value: javaAgent, }, { Name: "OTEL_SERVICE_NAME", From 3214fef9e6d79235cc1341e619080d1e34f15be1 Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Fri, 15 Mar 2024 22:50:27 +0800 Subject: [PATCH 2/4] fix with cr --- .chloggen/support-extensions.yaml | 16 +++++++++++ apis/v1alpha1/instrumentation_types.go | 2 +- apis/v1alpha1/zz_generated.deepcopy.go | 4 +-- .../opentelemetry.io_instrumentations.yaml | 28 ++++++++++--------- .../opentelemetry.io_instrumentations.yaml | 28 ++++++++++--------- docs/api.md | 8 +++--- pkg/instrumentation/javaagent.go | 11 ++++---- pkg/instrumentation/javaagent_test.go | 18 ++++++++++-- 8 files changed, 73 insertions(+), 42 deletions(-) create mode 100755 .chloggen/support-extensions.yaml diff --git a/.chloggen/support-extensions.yaml b/.chloggen/support-extensions.yaml new file mode 100755 index 0000000000..e727ec3142 --- /dev/null +++ b/.chloggen/support-extensions.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +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 + +# One or more tracking issues related to the change +issues: [1785] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/apis/v1alpha1/instrumentation_types.go b/apis/v1alpha1/instrumentation_types.go index c87b96da77..0c9ca6832f 100644 --- a/apis/v1alpha1/instrumentation_types.go +++ b/apis/v1alpha1/instrumentation_types.go @@ -136,7 +136,7 @@ type Java struct { // Extensions defines java specific extensions. // +optional - Extensions *Extensions `json:"extensions,omitempty"` + Extensions []Extensions `json:"extensions,omitempty"` } type Extensions struct { diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index df792ba43e..b173086ef6 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -374,8 +374,8 @@ func (in *Java) DeepCopyInto(out *Java) { in.Resources.DeepCopyInto(&out.Resources) if in.Extensions != nil { in, out := &in.Extensions, &out.Extensions - *out = new(Extensions) - **out = **in + *out = make([]Extensions, len(*in)) + copy(*out, *in) } } diff --git a/bundle/manifests/opentelemetry.io_instrumentations.yaml b/bundle/manifests/opentelemetry.io_instrumentations.yaml index 7a779407db..08c8f33761 100644 --- a/bundle/manifests/opentelemetry.io_instrumentations.yaml +++ b/bundle/manifests/opentelemetry.io_instrumentations.yaml @@ -921,19 +921,21 @@ spec: type: array extensions: description: Extensions defines java specific extensions. - properties: - dir: - description: Dir is a directory with extensions auto-instrumentation - JAR. - type: string - image: - description: Image is a container image with extensions auto-instrumentation - JAR. - type: string - required: - - dir - - image - type: object + items: + properties: + dir: + description: Dir is a directory with extensions auto-instrumentation + JAR. + type: string + image: + description: Image is a container image with extensions + auto-instrumentation JAR. + type: string + required: + - dir + - image + type: object + type: array image: description: Image is a container image with javaagent auto-instrumentation JAR. diff --git a/config/crd/bases/opentelemetry.io_instrumentations.yaml b/config/crd/bases/opentelemetry.io_instrumentations.yaml index 34d9f959d2..4e1728f2fa 100644 --- a/config/crd/bases/opentelemetry.io_instrumentations.yaml +++ b/config/crd/bases/opentelemetry.io_instrumentations.yaml @@ -919,19 +919,21 @@ spec: type: array extensions: description: Extensions defines java specific extensions. - properties: - dir: - description: Dir is a directory with extensions auto-instrumentation - JAR. - type: string - image: - description: Image is a container image with extensions auto-instrumentation - JAR. - type: string - required: - - dir - - image - type: object + items: + properties: + dir: + description: Dir is a directory with extensions auto-instrumentation + JAR. + type: string + image: + description: Image is a container image with extensions + auto-instrumentation JAR. + type: string + required: + - dir + - image + type: object + type: array image: description: Image is a container image with javaagent auto-instrumentation JAR. diff --git a/docs/api.md b/docs/api.md index f36e5f47ae..51adf3e6aa 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1907,8 +1907,8 @@ Java defines configuration for java auto-instrumentation. false - extensions - object + extensions + []object Extensions defines java specific extensions.
@@ -2195,12 +2195,12 @@ TODO: Add other useful fields. apiVersion, kind, uid?
-### Instrumentation.spec.java.extensions +### Instrumentation.spec.java.extensions[index] [↩ Parent](#instrumentationspecjava) -Extensions defines java specific extensions. + diff --git a/pkg/instrumentation/javaagent.go b/pkg/instrumentation/javaagent.go index bd68c6035c..cd1b5e6b4e 100644 --- a/pkg/instrumentation/javaagent.go +++ b/pkg/instrumentation/javaagent.go @@ -16,7 +16,6 @@ package instrumentation import ( "fmt" - corev1 "k8s.io/api/core/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" @@ -48,7 +47,7 @@ func injectJavaagent(javaSpec v1alpha1.Java, pod corev1.Pod, index int) (corev1. } javaJVMArgument := javaAgent - if javaSpec.Extensions != nil { + if len(javaSpec.Extensions) > 0 { javaJVMArgument = javaAgent + fmt.Sprintf(" -Dotel.javaagent.extensions=%s/extensions", javaInstrMountPath) } @@ -88,11 +87,11 @@ func injectJavaagent(javaSpec v1alpha1.Java, pod corev1.Pod, index int) (corev1. }}, }) - if javaSpec.Extensions != nil { + for i, extension := range javaSpec.Extensions { pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{ - Name: initContainerName + "-extensions", - Image: javaSpec.Extensions.Image, - Command: []string{"cp", "-r", javaSpec.Extensions.Dir, javaInstrMountPath + "/extensions"}, + Name: initContainerName + fmt.Sprintf("-extension-%d", i), + Image: extension.Image, + Command: []string{"cp", "-r", extension.Dir + "/.", javaInstrMountPath + "/extensions"}, Resources: javaSpec.Resources, VolumeMounts: []corev1.VolumeMount{{ Name: javaVolumeName, diff --git a/pkg/instrumentation/javaagent_test.go b/pkg/instrumentation/javaagent_test.go index 216c2dca51..ea8d81305d 100644 --- a/pkg/instrumentation/javaagent_test.go +++ b/pkg/instrumentation/javaagent_test.go @@ -87,7 +87,10 @@ func TestInjectJavaagent(t *testing.T) { }, { name: "add extensions to JAVA_TOOL_OPTIONS", - Java: v1alpha1.Java{Image: "foo/bar:1", Extensions: &v1alpha1.Extensions{Image: "ex/ex:1", Dir: "/ex"}}, + Java: v1alpha1.Java{Image: "foo/bar:1", Extensions: []v1alpha1.Extensions{ + {Image: "ex/ex:0", Dir: "/ex0"}, + {Image: "ex/ex:1", Dir: "/ex1"}, + }}, pod: corev1.Pod{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ @@ -118,9 +121,18 @@ func TestInjectJavaagent(t *testing.T) { }}, }, { - Name: "opentelemetry-auto-instrumentation-extensions", + Name: "opentelemetry-auto-instrumentation-extension-0", + Image: "ex/ex:0", + Command: []string{"cp", "-r", "/ex0/.", "/otel-auto-instrumentation-java/extensions"}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "opentelemetry-auto-instrumentation-java", + MountPath: "/otel-auto-instrumentation-java", + }}, + }, + { + Name: "opentelemetry-auto-instrumentation-extension-1", Image: "ex/ex:1", - Command: []string{"cp", "-r", "/ex", "/otel-auto-instrumentation-java/extensions"}, + Command: []string{"cp", "-r", "/ex1/.", "/otel-auto-instrumentation-java/extensions"}, VolumeMounts: []corev1.VolumeMount{{ Name: "opentelemetry-auto-instrumentation-java", MountPath: "/otel-auto-instrumentation-java", From 3aa23db9356532fb1d223dd046530af2984b6cd9 Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Sun, 7 Apr 2024 14:41:58 +0800 Subject: [PATCH 3/4] fix document --- .chloggen/support-extensions.yaml | 2 +- apis/v1alpha1/instrumentation_types.go | 1 + bundle/manifests/opentelemetry.io_instrumentations.yaml | 5 ----- config/crd/bases/opentelemetry.io_instrumentations.yaml | 5 ----- docs/api.md | 6 +++--- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.chloggen/support-extensions.yaml b/.chloggen/support-extensions.yaml index e727ec3142..ae7c6f110a 100755 --- a/.chloggen/support-extensions.yaml +++ b/.chloggen/support-extensions.yaml @@ -5,7 +5,7 @@ change_type: enhancement 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 +note: Support Java auto-instrumentation extensions. # One or more tracking issues related to the change issues: [1785] diff --git a/apis/v1alpha1/instrumentation_types.go b/apis/v1alpha1/instrumentation_types.go index 0c9ca6832f..8345d3c38a 100644 --- a/apis/v1alpha1/instrumentation_types.go +++ b/apis/v1alpha1/instrumentation_types.go @@ -135,6 +135,7 @@ type Java struct { Resources corev1.ResourceRequirements `json:"resources,omitempty"` // Extensions defines java specific extensions. + // All extensions are copied to a single directory; if a JAR with the same name exists, it will be overwritten. // +optional Extensions []Extensions `json:"extensions,omitempty"` } diff --git a/bundle/manifests/opentelemetry.io_instrumentations.yaml b/bundle/manifests/opentelemetry.io_instrumentations.yaml index d5d1a33c0e..4fd5de9a21 100644 --- a/bundle/manifests/opentelemetry.io_instrumentations.yaml +++ b/bundle/manifests/opentelemetry.io_instrumentations.yaml @@ -566,16 +566,11 @@ spec: type: object type: array extensions: - description: Extensions defines java specific extensions. items: properties: dir: - description: Dir is a directory with extensions auto-instrumentation - JAR. type: string image: - description: Image is a container image with extensions - auto-instrumentation JAR. type: string required: - dir diff --git a/config/crd/bases/opentelemetry.io_instrumentations.yaml b/config/crd/bases/opentelemetry.io_instrumentations.yaml index a68ca4b4da..b88d086f5b 100644 --- a/config/crd/bases/opentelemetry.io_instrumentations.yaml +++ b/config/crd/bases/opentelemetry.io_instrumentations.yaml @@ -564,16 +564,11 @@ spec: type: object type: array extensions: - description: Extensions defines java specific extensions. items: properties: dir: - description: Dir is a directory with extensions auto-instrumentation - JAR. type: string image: - description: Image is a container image with extensions - auto-instrumentation JAR. type: string required: - dir diff --git a/docs/api.md b/docs/api.md index 34a9dae58b..b581910073 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1829,7 +1829,7 @@ Resource Types: @@ -2123,14 +2123,14 @@ Resource Types: From a4fed6ae5fea82f338685b292f883eb0fc272ebf Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Thu, 11 Apr 2024 10:44:34 +0800 Subject: [PATCH 4/4] fix lint --- bundle/manifests/opentelemetry.io_instrumentations.yaml | 7 +++++++ config/crd/bases/opentelemetry.io_instrumentations.yaml | 7 +++++++ docs/api.md | 7 ++++--- pkg/instrumentation/javaagent.go | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bundle/manifests/opentelemetry.io_instrumentations.yaml b/bundle/manifests/opentelemetry.io_instrumentations.yaml index b117efcd32..bfecb6fa30 100644 --- a/bundle/manifests/opentelemetry.io_instrumentations.yaml +++ b/bundle/manifests/opentelemetry.io_instrumentations.yaml @@ -920,11 +920,18 @@ spec: type: object type: array extensions: + description: |- + Extensions defines java specific extensions. + All extensions are copied to a single directory; if a JAR with the same name exists, it will be overwritten. items: properties: dir: + description: Dir is a directory with extensions auto-instrumentation + JAR. type: string image: + description: Image is a container image with extensions + auto-instrumentation JAR. type: string required: - dir diff --git a/config/crd/bases/opentelemetry.io_instrumentations.yaml b/config/crd/bases/opentelemetry.io_instrumentations.yaml index a6d11e3202..f88a28852c 100644 --- a/config/crd/bases/opentelemetry.io_instrumentations.yaml +++ b/config/crd/bases/opentelemetry.io_instrumentations.yaml @@ -918,11 +918,18 @@ spec: type: object type: array extensions: + description: |- + Extensions defines java specific extensions. + All extensions are copied to a single directory; if a JAR with the same name exists, it will be overwritten. items: properties: dir: + description: Dir is a directory with extensions auto-instrumentation + JAR. type: string image: + description: Image is a container image with extensions + auto-instrumentation JAR. type: string required: - dir diff --git a/docs/api.md b/docs/api.md index 47d5edf086..4f9456fd9f 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1910,7 +1910,8 @@ Java defines configuration for java auto-instrumentation. @@ -2215,14 +2216,14 @@ TODO: Add other useful fields. apiVersion, kind, uid?
diff --git a/pkg/instrumentation/javaagent.go b/pkg/instrumentation/javaagent.go index cd1b5e6b4e..f77d3ae0c3 100644 --- a/pkg/instrumentation/javaagent.go +++ b/pkg/instrumentation/javaagent.go @@ -16,6 +16,7 @@ package instrumentation import ( "fmt" + corev1 "k8s.io/api/core/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
extensions []object - Extensions defines java specific extensions.
+
false
dir string - Dir is a directory with extensions auto-instrumentation JAR.
+
true
image string - Image is a container image with extensions auto-instrumentation JAR.
+
true
extensions []object -
+ Extensions defines java specific extensions. +All extensions are copied to a single directory; if a JAR with the same name exists, it will be overwritten.
false
dir string -
+ Dir is a directory with extensions auto-instrumentation JAR.
true
image string -
+ Image is a container image with extensions auto-instrumentation JAR.
true