Fix sys.user_summary scraper to handle negative current_memory values #985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
sys.user_summaryscraper failing when thecurrent_memorycolumn contains negative values in MySQL 8.0 Enterprise.Problem
The scraper attempts to parse
current_memoryasuint64(unsigned integer), which fails when MySQL returns negative values. According to MySQL documentation, negative memory values can occur when:This causes the scraper to fail with the following error:
Solution
current_memoryvariable type fromuint64toint64incollector/sys_user_summary.gofloat64for Prometheus metrics (no breaking changes)collector/sys_user_summary_test.gowith negative value (-16360) to prevent regressionChanges
File:
collector/sys_user_summary.go(Line 121)current_memory uint64→current_memory int64File:
collector/sys_user_summary_test.go(Lines 80-92)current_memory = "-16360"Testing
--collect.sys.user_summaryflagEnvironment Tested
--collect.sys.user_summary,--log.level=debugImpact
uint64andint64are 64-bit typesRelated
This issue affects users running MySQL 8.0 Enterprise with the
sys.user_summarycollector enabled.