-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[receiver/mysql]: add scraping io_waits metrics #14328
[receiver/mysql]: add scraping io_waits metrics #14328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. A couple minor points to address though.
receiver/mysqlreceiver/client.go
Outdated
query := ` | ||
SELECT OBJECT_SCHEMA, OBJECT_NAME, COUNT_DELETE, COUNT_FETCH, COUNT_INSERT, COUNT_UPDATE, | ||
SUM_TIMER_DELETE, SUM_TIMER_FETCH, SUM_TIMER_INSERT, SUM_TIMER_UPDATE | ||
FROM performance_schema.table_io_waits_summary_by_table | ||
WHERE OBJECT_SCHEMA NOT IN ('mysql', 'performance_schema'); | ||
` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably the extra whitespace is ignored by the database, but is it worth building the string in such a way where it is nicely formatted. I imagine users who see the query in the database's query log may find this format unusual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it a bit:
SELECT OBJECT_SCHEMA, OBJECT_NAME, COUNT_DELETE, COUNT_FETCH, COUNT_INSERT, COUNT_UPDATE,
SUM_TIMER_DELETE, SUM_TIMER_FETCH, SUM_TIMER_INSERT, SUM_TIMER_UPDATE
FROM performance_schema.table_io_waits_summary_by_table
WHERE OBJECT_SCHEMA NOT IN ('mysql', 'performance_schema');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still seems odd to me. It reads nicely in code, but why should it contain return chars and tabs that are useful only for the golang code? How about something like this:
query := "SELECT OBJECT_SCHEMA, OBJECT_NAME, COUNT_DELETE, COUNT_FETCH, COUNT_INSERT, " +
"COUNT_UPDATE, SUM_TIMER_DELETE, SUM_TIMER_FETCH, SUM_TIMER_INSERT, SUM_TIMER_UPDATE " +
"FROM performance_schema.table_io_waits_summary_by_table " +
"WHERE OBJECT_SCHEMA NOT IN ('mysql', 'performance_schema');"
It's simple and reads clearly in both go and sql domains.
receiver/mysqlreceiver/client.go
Outdated
query := ` | ||
SELECT OBJECT_SCHEMA, OBJECT_NAME, ifnull(INDEX_NAME, 'NONE') as INDEX_NAME, | ||
COUNT_FETCH, COUNT_INSERT, COUNT_UPDATE, COUNT_DELETE, | ||
SUM_TIMER_FETCH, SUM_TIMER_INSERT, SUM_TIMER_UPDATE, SUM_TIMER_DELETE | ||
FROM performance_schema.table_io_waits_summary_by_index_usage | ||
WHERE OBJECT_SCHEMA NOT IN ('mysql', 'performance_schema'); | ||
` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
d6b4488
to
2c04a3e
Compare
Changes applied. |
2c04a3e
to
bcb6c07
Compare
bcb6c07
to
62d963c
Compare
908badb
to
f4ce4e9
Compare
A small update regarding the time metrics: |
I agree with not using picoseconds. My suggestion would be to use nanoseconds and to represent it as an int ( |
c7cbf7a
to
e2d743e
Compare
e2d743e
to
536f620
Compare
Thanks for iterating @aboguszewski-sumo |
Description:
This PR adds scraping metrics related to I/O waits for tables and indices. There are 4 new metrics. List of used attributes was taken from here: https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mysql#tags
Link to tracking Issue:
#14138
Testing:
Unit tests for scraper and integration tests have been updated. The integration tests required putting some example data (empty schema, table and index), which is done in the
setup.sh
script.Documentation:
Documentation automatically generated by
mdatagen
.