Skip to content

Commit

Permalink
[O11y][MySQL] Update system test cases (#6394)
Browse files Browse the repository at this point in the history
* Update system test

* update changelog
  • Loading branch information
ali786XI authored Jun 2, 2023
1 parent fb34b72 commit 3099756
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 39 deletions.
3 changes: 2 additions & 1 deletion packages/mysql/_dev/deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG IMAGE=${IMAGE:-mysql:5.7.34}
ARG IMAGE=${IMAGE}
FROM ${IMAGE}

USER root
ENV MYSQL_ROOT_PASSWORD test

HEALTHCHECK --interval=1s --retries=90 CMD /healthcheck.sh
Expand Down
7 changes: 6 additions & 1 deletion packages/mysql/_dev/deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
version: '2.3'
services:
mysql:
build: .
build:
context: .
args:
IMAGE: ${IMAGE:-mysql:8.0.13}
ports:
- 3306
volumes:
- ${SERVICE_LOGS_DIR}/mysql:/var/log/mysql
- mysqldata:/var/lib/mysql
environment:
- IMAGE=${IMAGE:-mysql:8.0.13}
mysql_is_ready:
image: tianon/true
depends_on:
Expand Down
22 changes: 22 additions & 0 deletions packages/mysql/_dev/deploy/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,28 @@ chown mysql:mysql /var/log/mysql/*.log
chmod a+wx /var/log/mysql
chmod a+r -R /var/log/mysql

if [[ "$IMAGE" == "percona:8.0.13-4" ]]; then
# Write "test.cnf" config
cat << EOF > /etc/my.cnf.d/test.cnf
[mysqld]
user=root
bind-address = 0.0.0.0
log-error = /var/log/mysql/$HOSTNAME-error.log
EOF

# Write "slow-log.cnf" config (/var/lib/mysql/<hostname>-slow.log, but in the shared log directory).
cat << EOF > /etc/my.cnf.d/slow-log.cnf
[mysqld]
user=root
slow-query-log=ON
slow-query-log-file=/var/log/mysql/$HOSTNAME-slow.log
long-query-time=0
EOF

exec bash /docker-entrypoint.sh mysqld
fi

if [[ "$IMAGE" == "mysql:8.0.13" ]]; then
# Write "test.cnf" config
cat << EOF > /etc/mysql/conf.d/test.cnf
[mysqld]
Expand All @@ -26,3 +47,4 @@ long-query-time=0
EOF

exec bash /entrypoint.sh mysqld
fi
12 changes: 1 addition & 11 deletions packages/mysql/_dev/deploy/variants.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
variants:
mysql_5_7_12:
IMAGE: mysql:5.7.12
mysql_8_0_13:
IMAGE: mysql:8.0.13
percona_5_7_24:
IMAGE: percona:5.7.24
percona_8_0_13:
IMAGE: percona:8.0.13-4
mariadb_10_2_23:
IMAGE: mariadb:10.2.23
mariadb_10_3_14:
IMAGE: mariadb:10.3.14
mariadb_10_4_4:
IMAGE: mariadb:10.4.4
default: mysql_5_7_12
default: mysql_8_0_13
5 changes: 5 additions & 0 deletions packages/mysql/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.12.1"
changes:
- description: Add system test cases for performance datastream
type: enhancement
link: https://github.com/elastic/integrations/pull/6394
- version: "1.12.0"
changes:
- description: Rename ownership from obs-service-integrations to obs-infraobs-integrations
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vars:
hosts:
- tcp({{Hostname}}:{{Port}})/
username: root
password: test
data_stream:
vars: ~
49 changes: 24 additions & 25 deletions packages/mysql/data_stream/performance/sample_event.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
{
"@timestamp": "2023-01-25T14:23:17.060Z",
"@timestamp": "2023-05-30T09:51:54.708Z",
"agent": {
"ephemeral_id": "7e7fea68-fc17-44df-9a8e-6ceb55e55348",
"id": "c5ef7e66-470c-4ff7-aca5-4a28b7a75618",
"name": "docker-fleet-agent",
"id": "39205dfa-169a-4567-a887-12b5974403f0",
"type": "metricbeat",
"ephemeral_id": "57fc2e5d-6672-4ed3-a0cf-b70093c1f0dc",
"version": "8.5.3"
"version": "8.0.0"
},
"data_stream": {
"namespace": "default",
"type": "metrics",
"dataset": "mysql.performance"
"dataset": "mysql.performance",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.0.0"
},
"elastic_agent": {
"id": "39205dfa-169a-4567-a887-12b5974403f0",
"version": "8.5.3",
"snapshot": false
"id": "c5ef7e66-470c-4ff7-aca5-4a28b7a75618",
"snapshot": false,
"version": "8.0.0"
},
"event": {
"duration": 2867042,
"agent_id_status": "verified",
"ingested": "2023-01-25T14:23:18Z",
"module": "mysql",
"dataset": "mysql.performance"
"dataset": "mysql.performance",
"duration": 2102127,
"ingested": "2023-05-30T09:51:58Z",
"module": "mysql"
},
"host": {
"architecture": "x86_64",
"containerized": false,
"containerized": true,
"hostname": "docker-fleet-agent",
"id": "589e678e8f3f457d81e3a530d3ae6011",
"ip": [
"172.24.0.7"
"192.168.244.7"
],
"mac": [
"02-42-AC-18-00-07"
"02:42:c0:a8:f4:07"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "5.10.104-linuxkit",
"kernel": "3.10.0-1160.88.1.el7.x86_64",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.4 LTS (Focal Fossa)"
"version": "20.04.3 LTS (Focal Fossa)"
}
},
"metricset": {
Expand All @@ -58,7 +57,7 @@
"events_statements": {
"avg": {
"timer": {
"wait": 3722000000
"wait": 2884186000
}
},
"count": {
Expand All @@ -68,21 +67,21 @@
"text": "SELECT `digest_text` , `count_star` , `avg_timer_wait` , `max_timer_wait` , `last_seen` , `quantile_95` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `avg_timer_wait` DESC LIMIT ?"
},
"last": {
"seen": "2023-01-25T14:23:07.055308"
"seen": "2023-05-30T09:51:49.233295"
},
"max": {
"timer": {
"wait": 3722000000
"wait": 2884186000
}
},
"quantile": {
"95": 3801893963
"95": 3019951720
}
}
}
},
"service": {
"address": "tcp(host.docker.internal:52767)/?readTimeout=10s&timeout=10s&writeTimeout=10s",
"address": "tcp(elastic-package-service_mysql_1:3306)/?readTimeout=10s\u0026timeout=10s\u0026writeTimeout=10s",
"type": "mysql"
}
}
2 changes: 1 addition & 1 deletion packages/mysql/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 1.0.0
name: mysql
title: MySQL
version: "1.12.0"
version: "1.12.1"
license: basic
description: Collect logs and metrics from MySQL servers with Elastic Agent.
type: integration
Expand Down

0 comments on commit 3099756

Please sign in to comment.