Skip to content

Commit

Permalink
Update JMX tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
musa-asad committed Dec 13, 2024
1 parent 8628c7d commit 20fa9be
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 54 deletions.
8 changes: 3 additions & 5 deletions test/e2e/jmx/jmx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func testTomcatSessions(t *testing.T) {
}
}

time.Sleep(5 * time.Minute)
time.Sleep(3 * time.Minute)

startTime := time.Now().Add(-5 * time.Minute)
endTime := time.Now()
Expand Down Expand Up @@ -353,8 +353,6 @@ func testContainerInsightsMetrics(t *testing.T) {
{"jvm_memory_pool_bytes_used", "ContainerInsights/Prometheus"},
{"catalina_manager_activesessions", "ContainerInsights/Prometheus"},
{"catalina_manager_rejectedsessions", "ContainerInsights/Prometheus"},
{"catalina_globalrequestprocessor_bytesreceived", "ContainerInsights/Prometheus"},
{"catalina_globalrequestprocessor_bytessent", "ContainerInsights/Prometheus"},
{"catalina_globalrequestprocessor_requestcount", "ContainerInsights/Prometheus"},
{"catalina_globalrequestprocessor_errorcount", "ContainerInsights/Prometheus"},
{"catalina_globalrequestprocessor_processingtime", "ContainerInsights/Prometheus"},
Expand All @@ -369,7 +367,7 @@ func testContainerInsightsMetrics(t *testing.T) {
}

func testTomcatRejectedSessions(t *testing.T) {
t.Run("verify_tomcat_sessions", func(t *testing.T) {
t.Run("verify_catalina_manager_rejectedsessions", func(t *testing.T) {
cmd := exec.Command("kubectl", "get", "svc", "tomcat-service", "-o", "jsonpath='{.status.loadBalancer.ingress[0].hostname}'")
output, err := cmd.CombinedOutput()
if err != nil {
Expand All @@ -394,7 +392,7 @@ func testTomcatRejectedSessions(t *testing.T) {
}
}

time.Sleep(5 * time.Minute)
time.Sleep(3 * time.Minute)

startTime := time.Now().Add(-5 * time.Minute)
endTime := time.Now()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"logs": {
"metrics_collected": {
"kubernetes": {
"cluster_name": "TestCluster",
"jmx_container_insights": true
}
}
Expand Down
48 changes: 2 additions & 46 deletions test/e2e/jmx/resources/cwagent_configs/kafka.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,11 @@
"namespace": "KAFKA_E2E",
"metrics_collected": {
"jmx": {
"kafka": {
"measurement": [
"kafka.message.count",
"kafka.request.count",
"kafka.request.failed",
"kafka.request.time.total",
"kafka.request.time.50p",
"kafka.request.time.99p",
"kafka.request.time.avg",
"kafka.network.io",
"kafka.purgatory.size",
"kafka.partition.count",
"kafka.partition.offline",
"kafka.partition.under_replicated",
"kafka.isr.operation.count",
"kafka.max.lag",
"kafka.controller.active.count",
"kafka.leader.election.rate",
"kafka.unclean.election.rate",
"kafka.request.queue",
"kafka.logs.flush.time.count",
"kafka.logs.flush.time.median",
"kafka.logs.flush.time.99p"
]
},
"kafka-consumer": {
"measurement": [
"kafka.consumer.fetch-rate",
"kafka.consumer.records-lag-max",
"kafka.consumer.total.bytes-consumed-rate",
"kafka.consumer.total.fetch-size-avg",
"kafka.consumer.total.records-consumed-rate",
"kafka.consumer.bytes-consumed-rate",
"kafka.consumer.fetch-size-avg",
"kafka.consumer.records-consumed-rate"
]
},
"kakfa-producer": {
"measurement": [
"kafka.producer.io-wait-time-ns-avg",
"kafka.producer.outgoing-byte-rate",
"kafka.producer.request-latency-avg",
"kafka.producer.request-rate",
"kafka.producer.response-rate",
"kafka.producer.byte-rate",
"kafka.producer.compression-rate",
"kafka.producer.record-error-rate",
"kafka.producer.record-retry-rate",
"kafka.producer.record-send-rate"
"kafka.consumer.total.bytes-consumed-rate",
"kafka.consumer.fetch-rate"
]
}
}
Expand Down
57 changes: 54 additions & 3 deletions test/e2e/jmx/resources/sample_apps/kafka-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
spec:
containers:
- name: zookeeper
image: bitnami/zookeeper:latest
image: wurstmeister/zookeeper:latest
ports:
- containerPort: 2181
env:
Expand Down Expand Up @@ -59,13 +59,64 @@ spec:
spec:
containers:
- name: kafka
image: bitnami/kafka:latest
image: wurstmeister/kafka:latest
ports:
- containerPort: 9092
env:
- name: KAFKA_ZOOKEEPER_CONNECT
value: "zookeeper-service:2181"
- name: KAFKA_LISTENERS
value: "PLAINTEXT://:9092"
- name: KAFKA_ADVERTISED_LISTENERS
value: "PLAINTEXT://:9092"
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
value: "1"
value: "1"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka-producer
spec:
replicas: 1
selector:
matchLabels:
app: kafka-producer
template:
metadata:
labels:
app: kafka-producer
spec:
containers:
- name: kafka-producer
image: wurstmeister/kafka:latest
command: ["/bin/sh"]
args: ["-c", "while true; do echo 'Producing message'; kafka-console-producer.sh --broker-list kafka-service:9092 --topic test-topic | 'Test message'; sleep 5; done"]
env:
- name: KAFKA_BROKER_LIST
value: "kafka-service:9092"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka-consumer
spec:
replicas: 1
selector:
matchLabels:
app: kafka-consumer
template:
metadata:
labels:
app: kafka-consumer
annotations:
instrumentation.opentelemetry.io/inject-java: "true"
cloudwatch.aws.amazon.com/inject-jmx-kafka-consumer: "true"
spec:
containers:
- name: kafka-consumer
image: wurstmeister/kafka:latest
command: ["/bin/sh"]
args: ["-c", "kafka-console-consumer.sh --bootstrap-server kafka-service:9092 --topic test-topic --from-beginning"]
env:
- name: KAFKA_BROKER_LIST
value: "kafka-service:9092"

0 comments on commit 20fa9be

Please sign in to comment.