Skip to content

Commit 69c96cc

Browse files
authored
Add integration tests for JMX. (#244)
1 parent c8e6e2f commit 69c96cc

File tree

5 files changed

+61
-2
lines changed

5 files changed

+61
-2
lines changed

.github/workflows/operator-integration-test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,28 @@ jobs:
149149
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/manifests/cmd/ns_instrumentation_env_variables.json
150150
kubectl delete instrumentation sample-instrumentation
151151
152+
- name: Test for default instrumentation resources for jmx
153+
run: |
154+
kubectl delete pods --all -n default
155+
sleep 5
156+
cat integration-tests/jmx/sample-deployment-jmx.yaml
157+
kubectl apply -f integration-tests/jmx/sample-deployment-jmx.yaml
158+
sleep 5
159+
kubectl wait --for=condition=Available deployment/nginx -n default
160+
kubectl get pods -A
161+
kubectl describe pods -n default
162+
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/jmx/default_instrumentation_jmx_env_variables.json
163+
164+
- name: Test for defined instrumentation resources for jmx
165+
run: |
166+
kubectl apply -f integration-tests/manifests/sample-instrumentation.yaml
167+
kubectl delete pods --all -n default
168+
sleep 5
169+
kubectl wait --for=condition=Available deployment/nginx -n default
170+
sleep 5
171+
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/manifests/cmd/ns_instrumentation_env_variables.json
172+
kubectl delete instrumentation sample-instrumentation
173+
152174
- name: Test for default instrumentation resources for all languages
153175
run: |
154176
kubectl apply -f integration-tests/all-languages/sample-deployment-all-languages.yaml

integration-tests/all-languages/default_instrumentation_all-languages_env_variables.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"DOTNET_ADDITIONAL_DEPS": "/otel-auto-instrumentation-dotnet/AdditionalDeps",
2121
"OTEL_DOTNET_AUTO_HOME": "/otel-auto-instrumentation-dotnet",
2222
"DOTNET_SHARED_STORE": "/otel-auto-instrumentation-dotnet/store",
23-
"CORECLR_ENABLE_PROFILING": "1"
24-
23+
"CORECLR_ENABLE_PROFILING": "1",
24+
"OTEL_JMX_EXPORTER_METRICS_ENDPOINT": "http://cloudwatch-agent.amazon-cloudwatch:4314/v1/metrics",
25+
"OTEL_JMX_ENABLED": "true",
26+
"OTEL_JMX_TARGET_SYSTEM": "jvm,tomcat,kafka,kafka-consumer,kafka-producer"
2527
}

integration-tests/all-languages/sample-deployment-all-languages.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ spec:
1414
instrumentation.opentelemetry.io/inject-python: "true"
1515
instrumentation.opentelemetry.io/inject-java: "true"
1616
instrumentation.opentelemetry.io/inject-dotnet: "true"
17+
cloudwatch.aws.amazon.com/inject-jmx-jvm: "true"
18+
cloudwatch.aws.amazon.com/inject-jmx-tomcat: "true"
19+
cloudwatch.aws.amazon.com/inject-jmx-kafka: "true"
20+
cloudwatch.aws.amazon.com/inject-jmx-kafka-consumer: "true"
21+
cloudwatch.aws.amazon.com/inject-jmx-kafka-producer: "true"
1722
spec:
1823
containers:
1924
- name: nginx
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"OTEL_JMX_EXPORTER_METRICS_ENDPOINT": "http://cloudwatch-agent.amazon-cloudwatch:4314/v1/metrics",
3+
"OTEL_JMX_ENABLED": "true",
4+
"OTEL_JMX_TARGET_SYSTEM": "jvm,tomcat,kafka,kafka-consumer,kafka-producer"
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: nginx
9+
template:
10+
metadata:
11+
labels:
12+
app: nginx
13+
annotations:
14+
instrumentation.opentelemetry.io/inject-java: "true"
15+
cloudwatch.aws.amazon.com/inject-jmx-jvm: "true"
16+
cloudwatch.aws.amazon.com/inject-jmx-tomcat: "true"
17+
cloudwatch.aws.amazon.com/inject-jmx-kafka: "true"
18+
cloudwatch.aws.amazon.com/inject-jmx-kafka-consumer: "true"
19+
cloudwatch.aws.amazon.com/inject-jmx-kafka-producer: "true"
20+
spec:
21+
containers:
22+
- name: nginx
23+
image: nginx:1.14.2
24+
restartPolicy: Always
25+
status: {}

0 commit comments

Comments
 (0)