PMM-15195 Fixes and MySQL 9.7 changes. - #5648
Conversation
|
@copilot review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5648 +/- ##
==========================================
- Coverage 43.59% 43.36% -0.23%
==========================================
Files 415 433 +18
Lines 43134 35016 -8118
Branches 0 591 +591
==========================================
- Hits 18804 15186 -3618
+ Misses 22454 18340 -4114
+ Partials 1876 1490 -386
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@copilot review |
|
@copilot review |
|
@copilot review |
|
@CodeRabbit full review |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughMySQL dashboards now use corrected node aggregation, native metric names, and legacy fallbacks. Query Cache and table-metric availability is documented. The redo-log sizing check validates metric availability before calculating alert values. ChangesMySQL observability updates
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dashboards/dashboards/MySQL/MySQL_InnoDB_Details.json`:
- Line 17124: Update the purge records expression to add an irate(...[5m])
fallback for both native and legacy counter metrics alongside their existing
rate(...[$interval]) alternatives, matching the fallback pattern used by the
sibling Purge Invoked panel. Preserve the existing avg by (service_name)
aggregation and counter pairing.
- Line 420: Ensure the dashboard’s mysql_innodb_redo_log_* metrics are actually
exposed before deployment by upgrading mysqld_exporter to a version supporting
them or implementing equivalent built-in collectors or Prometheus recording
rules. Cover all referenced metrics, including
mysql_innodb_redo_log_checkpoint_age_ratio,
mysql_innodb_redo_log_written_bytes_total, and
mysql_innodb_redo_log_current_lsn, while preserving the existing fallback
queries.
In `@dashboards/dashboards/MySQL/MySQL_Instances_Compare.json`:
- Around line 3351-3366: Update the content text in the text panel with id 9003
(in the options.content field) to qualify the MariaDB query-cache statement.
Change "MariaDB still provides a query cache" to "MariaDB may still provide a
query cache" or append "unless MariaDB was built without it" to account for
builds that omit query cache support.
In `@dashboards/dashboards/MySQL/MySQL_Performance_Schema_Details.json`:
- Line 366: Update the panel query associated with the description near the
MySQL Performance Schema status variables to filter series using increase over
$__range rather than max_over_time of the cumulative lost counter. Evaluate the
increase at the range end so zero samples before the first in-range loss remain
visible, while excluding series with no counter increase during the selected
range.
In `@managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml`:
- Around line 72-73: Remove the early return for an empty docs[3] in the check
flow, allowing execution to reach the write-volume warning that uses docs[1] and
docs[2]. Gate only the checkpoint-age error logic on docs[3] being present,
while preserving the existing behavior for valid checkpoint-age samples.
- Around line 57-58: Update the range-sample processing in the MySQL InnoDB redo
log check to parse each row[1] value once as a floating-point number, then reuse
that parsed value for total, maximum, and threshold comparisons. Preserve the
existing empty-result handling while replacing integer parsing so fractional
samples such as 123.5 are processed successfully.
- Around line 46-58: Update the redo-log written metric handling in the MySQL
check to use mysql_innodb_redo_log_written_bytes_total as the primary series and
fall back to mysql_global_status_innodb_os_log_written when the canonical series
is unavailable. Ensure the range query requests both metrics and preserve the
existing empty-data guard before calculating the spike.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 24b018c6-2638-467e-8ba1-124954665f82
📒 Files selected for processing (8)
dashboards/dashboards/MySQL/MySQL_InnoDB_Compression_Details.jsondashboards/dashboards/MySQL/MySQL_InnoDB_Details.jsondashboards/dashboards/MySQL/MySQL_Instance_Summary.jsondashboards/dashboards/MySQL/MySQL_Instances_Compare.jsondashboards/dashboards/MySQL/MySQL_Instances_Overview.jsondashboards/dashboards/MySQL/MySQL_Performance_Schema_Details.jsondashboards/dashboards/MySQL/MySQL_Table_Details.jsonmanaged/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (3)
managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml (3)
57-58: 🩺 Stability & Availability | 🟠 MajorParse every
increase()sample as a floating-point value.The query in Line 17 uses
increase(). Its samples can be fractional. Lines 62-67 still callint(row[1]), so a value such as"123.5"can abort the check. Parse each sample once withfloat()and reuse it for the total, maximum, and threshold comparison.Proposed parsing change
for row in docs[1][0]["values"]: logsWritten.append(row[1]) - logs_written_tot = int(logs_written_tot) + int(row[1]) - if logs_written_max < int(row[1]): - logs_written_max = int(row[1]) + sample = float(row[1]) + logs_written_tot += sample + if logs_written_max < sample: + logs_written_max = sample cnt = int(cnt) + 1 - if int(row[1]) > redo_log_size: + if sample > redo_log_size:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml` around lines 57 - 58, Update the check’s `increase()` sample processing to parse each sample value once with `float()` instead of `int(row[1])`. Reuse the parsed floating-point value when calculating the total, maximum, and threshold comparison, preserving the existing behavior for empty results.
72-73: 🎯 Functional Correctness | 🟠 MajorDo not skip the write-volume warning when checkpoint data is missing.
If
docs[3]is empty, these lines return before thecnt_highwarning at Line 91. Gate only the checkpoint-age loop and continue to the write-volume branch.Proposed control-flow change
- if len(docs[3]) == 0: - return None - for row in docs[3][0]["values"]: - checkpoint_age_usage_perc.append(row[1]) - if float(row[1]) > 80: - chkpt_alert = int(chkpt_alert) + 1 + if len(docs[3]) > 0: + for row in docs[3][0]["values"]: + checkpoint_age_usage_perc.append(row[1]) + if float(row[1]) > 80: + chkpt_alert = int(chkpt_alert) + 1🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml` around lines 72 - 73, Update the check flow around the docs[3] empty-data guard so it does not return None; instead, skip only the checkpoint-age loop when checkpoint data is missing and continue into the cnt_high write-volume warning branch. Preserve the existing checkpoint processing when docs[3] contains data.
57-58: 🗄️ Data Integrity & Integration | 🟠 MajorQuery the native redo-log write metric before applying this guard.
docs[1]still comes only frommysql_global_status_innodb_os_log_writtenin Line 17. If the updated exporter exposes onlymysql_innodb_redo_log_written_bytes_total, this guard returnsNoneand disables the advisor. Query the native series first and retain the legacy series as the fallback.Proposed query change
- query: avg by (service_name) (increase(mysql_global_status_innodb_os_log_written{service_name=~"{{.ServiceName}}"}[1h])) + query: (avg by (service_name) (increase(mysql_innodb_redo_log_written_bytes_total{service_name=~"{{.ServiceName}}"}[1h]))) or (avg by (service_name) (increase(mysql_global_status_innodb_os_log_written{service_name=~"{{.ServiceName}}"}[1h])))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml` around lines 57 - 58, Update the query flow in the check to retrieve the native mysql_innodb_redo_log_written_bytes_total series before the existing docs[1] empty-result guard, and use the legacy mysql_global_status_innodb_os_log_written series only as fallback. Ensure the guard evaluates the native result when available so the advisor remains enabled with the updated exporter metric.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dashboards/dashboards/MySQL/MySQL_Instances_Overview.json`:
- Line 5668: Update the Query Cache descriptions at both notices near the
existing entries at lines 5668 and 6188 to state that MariaDB retains Query
Cache support but it may be disabled by default or compiled out, so empty charts
are expected in that case. Preserve the existing Oracle MySQL and Percona
removal context.
In `@dashboards/dashboards/MySQL/MySQL_Table_Details.json`:
- Line 450: Update the dashboard description text and both related panel titles
in the MySQL table details dashboard to label fetch, insert, update, and delete
metrics as table I/O operation-count proxies rather than row counts. Replace
“Rows Read” and “Rows Changed” wording while preserving the existing metric
references and panel behavior.
In `@managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml`:
- Line 83: Update the alert description near redo_log_size to say “past 7 days”
instead of “past 24h,” and make the corresponding wording change in the warning
text near the same check. Keep the 168-hour query range and all calculated
values unchanged.
---
Duplicate comments:
In `@managed/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml`:
- Around line 57-58: Update the check’s `increase()` sample processing to parse
each sample value once with `float()` instead of `int(row[1])`. Reuse the parsed
floating-point value when calculating the total, maximum, and threshold
comparison, preserving the existing behavior for empty results.
- Around line 72-73: Update the check flow around the docs[3] empty-data guard
so it does not return None; instead, skip only the checkpoint-age loop when
checkpoint data is missing and continue into the cnt_high write-volume warning
branch. Preserve the existing checkpoint processing when docs[3] contains data.
- Around line 57-58: Update the query flow in the check to retrieve the native
mysql_innodb_redo_log_written_bytes_total series before the existing docs[1]
empty-result guard, and use the legacy mysql_global_status_innodb_os_log_written
series only as fallback. Ensure the guard evaluates the native result when
available so the advisor remains enabled with the updated exporter metric.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f1956c3d-234f-4492-8cd4-c0e3cf6d7671
📒 Files selected for processing (8)
dashboards/dashboards/MySQL/MySQL_InnoDB_Compression_Details.jsondashboards/dashboards/MySQL/MySQL_InnoDB_Details.jsondashboards/dashboards/MySQL/MySQL_Instance_Summary.jsondashboards/dashboards/MySQL/MySQL_Instances_Compare.jsondashboards/dashboards/MySQL/MySQL_Instances_Overview.jsondashboards/dashboards/MySQL/MySQL_Performance_Schema_Details.jsondashboards/dashboards/MySQL/MySQL_Table_Details.jsonmanaged/data/checks/mysql_innodb_redo_logs_not_sized_correctly.yml
PMM-15195
MySQL Exporter PR: percona/mysqld_exporter#387
PT PR: percona/percona-toolkit#1152
FB: Percona-Lab/pmm-submodules#4479
Summary
Makes PMM's MySQL dashboards and the InnoDB redo log advisor work with Oracle MySQL 9.7,
where a number of legacy status variables and
INFORMATION_SCHEMA.INNODB_METRICScountersno longer exist. Every query prefers the new canonical
mysql_innodb_*metrics exposed bythe updated mysqld_exporter and falls back to the legacy metric names, so older exporters
and older MySQL / Percona Server / MariaDB versions keep rendering exactly as before.
Dashboard changes
InnoDB redo log, checkpoint and LSN panels (
MySQL InnoDB Details,MySQL Instance Summary,MySQL Instances Compare,MySQL Instances Overview)mysql_innodb_redo_log_checkpoint_age_ratio/mysql_innodb_redo_log_checkpoint_age_byteswith the legacy status and INNODB_METRICSchain kept as fallback.
mysql_innodb_redo_log_capacity_bytesand wasrenamed from "Max Checkpoint Age" to "Redo Log Capacity / Max Checkpoint Age", because on
MySQL 8.0.30+ the denominator is the full redo log capacity while older servers only expose
the (smaller) sync flush threshold. Panel descriptions now explain this difference so the
same workload showing a different percentage across versions isn't read as a regression.
neighbor flush panels switched to
mysql_innodb_redo_log_*/mysql_innodb_metrics_*with legacy fallbacks.
Fixes found along the way
max by ()instead ofmax by (node_name),which broke the
on (node_name)join. Fixed in all three dashboards where it appears.(
mysql_global_status_buffer_pool_page_changes_total_pool_page_changes_total) in therate()branch, so only theirate()fallback ever returned data.MySQL InnoDB Compression Details) aggregated awaynode_namebefore dividing by the CPU count, so the vector match never produced a result. They also
carried a hardcoded
"interval": "1h"that ignored the dashboard time range; both removed.One query also used the wrong label (
service/instanceinstead ofservice_name).> 0per sample, which hid thezero-valued samples between events. It now keeps a series only if it lost anything over the
selected range, so an empty panel genuinely means nothing was lost.
descriptionkey inMySQL Instances Overview.Compatibility notices
MySQL Instance Summary,MySQL Instances CompareandMySQL Instances Overviewnow carry a notice that Query Cache was removed in OracleMySQL 8.0 and Percona Server 8.0 and that empty charts are expected there, with the
surrounding panel layout adjusted for the extra text panel.
MySQL Table Detailsdocuments which source feeds table activity per flavor.Community MySQL table activity fallback (
MySQL Table Details)Top Tables by Rows Read / Rows Changed relied on
INFORMATION_SCHEMA.TABLE_STATISTICS,which only Percona Server and MariaDB provide with
userstatenabled. They now fall backto
mysql_perf_schema_table_io_waits_total(fetchfor reads,insert|update|deleteforchanges), so Oracle MySQL including 9.7 gets data.
Advisor changes
mysql_innodb_redo_logs_not_sized_correctlynever fired on MySQL 8.0.30+ and misbehaved on 9.x:innodb_redo_log_capacity, falling back toinnodb_log_files_in_group * innodb_log_file_sizefor older servers that still expose them.mysql_innodb_redo_log_checkpoint_age_ratio, with the legacyratio computation as fallback.
variable meant a zero size, which flagged every sample as a spike.
Related changes
This PR should be released together with:
Test plan
agents are running.
activity workloads, and verified all affected canonical queries return data.
actually lost events.
Summary by CodeRabbit