Skip to content

Commit

Permalink
Add e2e tests for java auto-instrumentation (#498)
Browse files Browse the repository at this point in the history
* Add e2e tests for java auto-instrumentation

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
  • Loading branch information
pavolloffay committed Nov 5, 2021
1 parent d115a37 commit c842ede
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/e2e/instrumentation-java/00-install-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: sidecar
spec:
mode: sidecar
args:
metrics-level: detailed
log-level: debug
config: |
receivers:
otlp:
protocols:
grpc:
http:
processors:
exporters:
logging:
service:
pipelines:
traces:
receivers: [otlp]
processors: []
exporters: [logging]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: java
spec:
exporter:
endpoint: http://localhost:4318
java:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java:latest
27 changes: 27 additions & 0 deletions tests/e2e/instrumentation-java/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Pod
metadata:
annotations:
sidecar.opentelemetry.io/inject: "true"
instrumentation.opentelemetry.io/inject-java: "true"
labels:
app: my-pod-with-sidecar
spec:
containers:
- name: myapp
env:
- name: OTEL_SERVICE_NAME
value: myapp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://localhost:4318
- name: JAVA_TOOL_OPTIONS
value: " -javaagent:/otel-auto-instrumentation/javaagent.jar"
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
- mountPath: /otel-auto-instrumentation
name: opentelemetry-auto-instrumentation
- name: otc-container
initContainers:
- name: opentelemetry-auto-instrumentation
status:
phase: Running
20 changes: 20 additions & 0 deletions tests/e2e/instrumentation-java/01-install-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment-with-sidecar
spec:
selector:
matchLabels:
app: my-pod-with-sidecar
replicas: 1
template:
metadata:
labels:
app: my-pod-with-sidecar
annotations:
sidecar.opentelemetry.io/inject: "true"
instrumentation.opentelemetry.io/inject-java: "true"
spec:
containers:
- name: myapp
image: ghcr.io/pavolloffay/spring-petclinic:latest

0 comments on commit c842ede

Please sign in to comment.