Skip to content
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] feat: add table size metrics #32680

Merged
merged 2 commits into from
May 20, 2024

Conversation

s-v-a-n
Copy link
Contributor

@s-v-a-n s-v-a-n commented Apr 24, 2024

Description: This adds table size metrics using the INFORMATION_SCHEMA TABLES table: https://dev.mysql.com/doc/refman/8.3/en/information-schema-tables-table.html. Specifically, we are adding the columns:

TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH, INDEX_LENGTH

Link to tracking issue: #32693

Testing: Added testing data, tested locally against MySQL 8.

Documentation: By default, the metric is turned off. When enabled, make sure that the MySQL user has access to the tables being monitored.

@djaglowski
Copy link
Member

Is there a corresponding issue for this PR?

@s-v-a-n
Copy link
Contributor Author

s-v-a-n commented Apr 25, 2024

Is there a corresponding issue for this PR?

No, I didn’t see an existing one. However, I've just created a new one: #32693

@s-v-a-n s-v-a-n changed the title feat: add table size metrics [receiver/mysql] feat: add table size metrics Apr 25, 2024
@s-v-a-n s-v-a-n marked this pull request as ready for review April 26, 2024 04:44
@s-v-a-n s-v-a-n requested a review from a team as a code owner April 26, 2024 04:44
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
receiver/mysqlreceiver/metadata.yaml Outdated Show resolved Hide resolved
@s-v-a-n s-v-a-n force-pushed the table-size-metric branch 4 times, most recently from 3bb8959 to 2027133 Compare May 6, 2024 05:13
@s-v-a-n
Copy link
Contributor Author

s-v-a-n commented May 6, 2024

@djaglowski I've updated the PR to clean it up. Please review. Thank you

@s-v-a-n s-v-a-n requested review from djaglowski and frzifus May 6, 2024 23:34
@s-v-a-n s-v-a-n force-pushed the table-size-metric branch 2 times, most recently from 4af2bc5 to 3d8aa8a Compare May 7, 2024 17:15
Comment on lines 334 to 351
mysql.table.total_length:
enabled: false
description: The total length (sum of data_length and index_length) in bytes for a given table.
unit: By
sum:
value_type: int
monotonic: false
aggregation_temporality: cumulative
attributes: [table_name, schema]
mysql.table.data_length:
enabled: false
description: The data length in bytes for a given table.
unit: By
sum:
value_type: int
monotonic: false
aggregation_temporality: cumulative
attributes: [table_name, schema]
mysql.table.index_length:
enabled: false
description: The index length in bytes for a given table.
unit: By
sum:
value_type: int
monotonic: false
aggregation_temporality: cumulative
attributes: [table_name, schema]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just model this as one metric with two data points and an attribute which is either data or index? This is how OTel's data model is intended to work, rather than just returning sums as separate metrics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. I'll remove the total_length metric.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have separate metrics for data and index length. The problem with this is that it is now difficult for users to combine the two in most backends. OTel typically will combine these into one metric and use an attribute to differentiate between the two. Any reason not to do this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, typically can we name this metric mysql.table.size?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood your last comment. I'll have that changed. Thank you for the review!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see two separate metrics

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djaglowski Please check now. Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djaglowski Checking in - please let me now if there needs additional changes

@s-v-a-n s-v-a-n requested a review from djaglowski May 9, 2024 05:57
@s-v-a-n s-v-a-n force-pushed the table-size-metric branch 7 times, most recently from b93c042 to 6cfa283 Compare May 15, 2024 17:59
@djaglowski djaglowski merged commit 7ddb350 into open-telemetry:main May 20, 2024
162 checks passed
@github-actions github-actions bot added this to the next release milestone May 20, 2024
@s-v-a-n s-v-a-n deleted the table-size-metric branch May 20, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants