Skip to content

Commit

Permalink
[O11y][MySQL] Update query for performance data stream (#38363)
Browse files Browse the repository at this point in the history
* mysql update query

* add changelog entry

* mage check command

* make update

* change in python version to fix CI issue

* update python version

* revert changes of python file

* revert install-tools.bat file changes

* Merge branch 'main' of https://github.com/harnish-elastic/beats into mysql-update-query

* address review comments

* address review comments

* revert schema to schemaname to avoid error

---------

Co-authored-by: subham sarkar <[email protected]>
  • Loading branch information
harnish-elastic and shmsr authored Jun 3, 2024
1 parent d535d17 commit 8cc85a2
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Align on the algorithm used to transform Prometheus histograms into Elasticsearch histograms {pull}36647[36647]
- Add linux IO metrics to system/process {pull}37213[37213]
- Add new memory/cgroup metrics to Kibana module {pull}37232[37232]
- Support schema_name for MySQL performance metricset {pull}38363[38363]
- Add SSL support to mysql module {pull}37997[37997]
- Add SSL support for aerospike module {pull}38126[38126]
- Add last_terminated_timestamp metric in kubernetes module {pull}39200[39200] {issue}3802[3802]
Expand Down
9 changes: 9 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53661,6 +53661,15 @@ type: long

--

*`mysql.performance.events_statements.schemaname`*::
+
--
Schema name.

type: keyword

--

[float]
=== table_io_waits

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/mysql/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 50 additions & 30 deletions metricbeat/module/mysql/performance/_meta/data.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,82 @@
{
"@timestamp": "2020-07-13T13:43:28.495Z",
"@timestamp": "2024-02-27T07:33:02.881Z",
"@metadata": {
"beat": "metricbeat",
"type": "_doc",
"version": "8.0.0"
},
"event": {
"duration": 1379935,
"dataset": "mysql.performance",
"module": "mysql"
},
"metricset": {
"name": "performance",
"period": 10000
},
"service": {
"address": "tcp(172.17.0.2:3306)/",
"type": "mysql"
"version": "8.14.0"
},
"mysql": {
"performance": {
"events_statements": {
"digest": {
"text": "SELECT @@SESSION . `auto_increment_increment` AS `auto_increment_increment` , @@`character_set_client` AS `character_set_client` , @@`character_set_connection` AS `character_set_connection` , @@`character_set_results` AS `character_set_results` , @@`character_set_server` AS `character_set_server` , @@`collation_server` AS `collation_server` , @@`collation_connection` AS `collation_connection` , @@`init_connect` AS `init_connect` , @@`interactive_timeout` AS `interactive_timeout` , @@`license` AS `license` , @@`lower_case_table_names` AS `lower_case_table_names` , @@`max_allowed_packet` AS `max_allowed_packet` , @@`net_write_timeout` AS `net_write_timeout` , @@`performance_schema` AS `performance_schema` , @@`sql_mode` AS `sql_mode` , @@`system_time_zone` AS `system_time_zone` , @@`time_zone` AS `time_zone` , @@`transaction_isolation` AS `transaction_isolation` , @@`wait_timeout` AS `wait_timeout`"
"text": "SHOW SCHEMAS"
},
"count": {
"star": 2
"star": 5
},
"avg": {
"timer": {
"wait": 1.78294e+08
"wait": 1.6439131e+10
}
},
"max": {
"timer": {
"wait": 1.89622e+08
"wait": 4.0834164e+10
}
},
"last": {
"seen": "2020-07-13 10:04:47.709230"
"seen": "2024-02-27 06:44:17.296246"
},
"quantile": {
"95": 1.90546071e+08
}
"95": 4.1686938347e+10
},
"schemaname": "performance_schema"
}
}
},
"ecs": {
"version": "1.5.0"
},
"host": {
"name": "mcastro"
"id": "41359f29035549cda159ae8d1a533d72",
"containerized": false,
"ip": [
"127.0.0.1"
],
"name": "localhost",
"mac": [
"86-32-76-45-EB-2B"
],
"hostname": "localhost",
"architecture": "x86_64",
"os": {
"name": "CentOS Linux",
"kernel": "3.10.0-1160.102.1.el7.x86_64",
"codename": "Core",
"type": "linux",
"platform": "centos",
"version": "7 (Core)",
"family": "redhat"
}
},
"agent": {
"id": "803dfdba-e638-4590-a2de-80cb1cebe78d",
"name": "mcastro",
"type": "metricbeat",
"version": "8.0.0",
"ephemeral_id": "f87e6edc-2f37-45f2-9644-b67b1834abfd"
"version": "8.14.0",
"ephemeral_id": "539a163b-91ab-433c-9893-31a48d09b5a7",
"id": "e5bcfbf0-4c74-44dd-b711-c5e90a69ab7a",
"name": "localhost"
},
"ecs": {
"version": "8.0.0"
},
"event": {
"dataset": "mysql.performance",
"module": "mysql",
"duration": 14244062
},
"metricset": {
"period": 10000,
"name": "performance"
},
"service": {
"address": "tcp(127.0.0.1:3306)/?readTimeout=10s&timeout=10s&writeTimeout=10s",
"type": "mysql"
}
}
3 changes: 3 additions & 0 deletions metricbeat/module/mysql/performance/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
- name: 'avg.timer.wait'
type: long
description: Average wait time of the summarized events that are timed
- name: 'schemaname'
type: keyword
description: Schema name.
- name: table_io_waits
type: group
description: Records table I/O waits by index
Expand Down
8 changes: 4 additions & 4 deletions metricbeat/module/mysql/performance/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ input:
namespace: performance
queries:
- query: >
SELECT digest_text, count_star, avg_timer_wait, max_timer_wait, last_seen /*!80001 ,quantile_95 */
FROM performance_schema.events_statements_summary_by_digest
ORDER BY avg_timer_wait DESC
LIMIT 10;
SELECT schema_name AS schemaname, digest_text, count_star, avg_timer_wait, max_timer_wait, last_seen /*!80001 ,quantile_95 */
FROM performance_schema.events_statements_summary_by_digest
ORDER BY avg_timer_wait DESC
LIMIT 10;
query_namespace: events_statements
response_format: table
replace_underscores: true
Expand Down

0 comments on commit 8cc85a2

Please sign in to comment.