PMM-14109 Improve Advisor UX#5656
Draft
ademidoff wants to merge 69 commits into
Draft
Conversation
- Implemented MarkCheckResultsRead function in the service layer to update the read state of check results. - Added corresponding API endpoint for marking check results as read. - Introduced new parameters and response structures for the API. - Updated settings model to include Advisor notification settings. - Enhanced environment variable parsing to support new Advisor notification feature. - Added tests for the new functionality to ensure proper behavior.
…verity threshold
…d Advisor Notifications
…y Fields - Introduced CheckSeverity and CheckTriggeredBy types to represent the severity levels and initiators of advisor checks. - Updated CheckResult model to include Severity (CheckSeverity) and TriggeredBy (CheckTriggeredBy) fields. - Modified database schema to accommodate new fields in the check_results table. - Adjusted related services and models to handle the new fields, including changes in the execution flow of advisor checks. - Updated API services to support the new fields in requests and responses. - Enhanced tests to cover new functionality and ensure proper handling of severity and triggered by information.
… components - Introduced new fields: environment, cluster, replication_set, and outcome to CheckResultHistoryItem in advisors.proto. - Updated validation logic in advisors.pb.validate.go to include new fields. - Modified JSON representations in list_check_results_history_responses.go and v1.json to accommodate new fields. - Adjusted database schema and models to reflect new fields in CheckResult. - Enhanced tests to validate new fields and ensure proper functionality in AdvisorInsights components.
…, updating labels, and enhancing test coverage
Replace the Grafana alert-rule based advisor notifications with direct email delivery. When advisor notifications are enabled, PMM emails a summary of each completed check batch to the Grafana email contact point named "PMM Advisor Insights", reusing Grafana's SMTP configuration (the inherited GF_SMTP_* environment) instead of duplicating it. - Resolve and cache the contact point's recipients when settings change, since the batch-completion path runs in a background context with no Grafana credentials. - On batch completion, filter insights by the configured severity threshold, format each like the UI's "Copy to text", and send via SMTP. - Compose the email with an intro (batch id and how the batch was triggered), a per-severity summary and next steps, followed by the insights. - Drop the now-unused alert-rule helpers and Grafana client methods. - Center the "No advisor insights found" empty-state message.
- Introduced new Advisors settings tab in the UI. - Created AdvisorsForm component for managing advisor settings. - Implemented validation and schema for advisor settings using Zod. - Added utility functions for converting intervals and handling advisor settings. - Updated Settings.messages.ts to include new messages related to advisors. - Refactored AdvancedSettingsForm to remove advisor-related fields. - Added tests for new AdvisorsForm and its utilities.
… components - Changed AdvisorName to Subcategory in CheckResult and related structures. - Updated tests to reflect changes in advisor structure. - Modified UI components to display Subcategory instead of AdvisorName. - Adjusted filtering and sorting logic in AdvisorsList and AdvisorInsights. - Removed unused createComment function and related tests. - Updated YAML configuration for checks to include category and subcategory.
…toryItem and update related validation and JSON responses
User-authored advisor checks are now stored in the database with full create/read/update/delete support in the API and UI. Percona-shipped checks stay on disk and immutable; users can copy their code or clone them into new editable checks. The filesystem injection env var (PMM_DEV_ADVISOR_CHECKS_FILE) is removed in favor of DB storage. API: extend AdvisorCheck with category, subcategory, user_defined, queries and script; add CreateAdvisorCheck, UpdateAdvisorCheck, DeleteAdvisorCheck and GetAdvisorCheck. managed: add migration 120 (advisor_checks table), reform model and helpers; merge DB checks into the in-memory list (built-in wins on name collision); add CRUD service methods and API handlers. ui: add the authoring overlay (create/edit/clone) with structured fields and a script textarea; add Edit/Delete row actions and Clone from the details pane; add an Author column and drop the Description column.
Drop the redundant models.CheckSeverity string enum and its three conversion helpers (convertCommonSeverity, convertModelSeverity, convertAPISeverity). CheckResult.Severity now uses the existing models.Severity (a common.Severity persisted as its lowercase string name via Value/Scan), so severity levels are defined once in pi/common. The stored representation is unchanged, so no migration is needed; common.Severity <-> managementv1.Severity is a direct cast (aligned enum values). The history severity filter now treats SEVERITY_UNSPECIFIED as "no filter".
ademidoff
temporarily deployed
to
PMM-14109-improve-advisor-ux - pmm-doc-3 PR #5656
July 21, 2026 21:06 — with
Render
Destroyed
ademidoff
temporarily deployed
to
PMM-14109-improve-advisor-ux - pmm-doc-3 PR #5656
July 21, 2026 21:07 — with
Render
Destroyed
ademidoff
force-pushed
the
PMM-14109-improve-advisor-ux
branch
from
July 21, 2026 21:56
25c00a3 to
e9eab3f
Compare
The new CheckResult fixtures defaulted Severity to Unknown (0), which models.Severity.Value() rejects via Validate(), failing the inserts with "unknown severity level: unknown". Set a valid severity on the affected rows.
When pmm-managed-starlark exits non-zero, cmd.Output() only yields "exit status 1", hiding the real cause. Propagate the subprocess stderr into the returned error (which becomes the check result outcome), and have the subprocess write its failure as plain text rather than logrus-decorated output. Distinguish a script timeout from other failures.
These checks crashed inside their Starlark scripts (previously masked as "exit status 1"): - mysql_automatic_expired_password: undefined var (deps -> rows) - mysql_ahi_efficiency_performance_basic_check: divide-by-zero when all wait samples are 0 - mysql_config_innodb_redolog_disabled, mysql_replication_grants, mysql_security_user_ssl: guard version-gated columns absent on 5.7 - mysql_config_binlog_retention_period: look up expire_logs_days / binlog_expire_logs_seconds via performance_schema so the query works across 5.7, 8.0 and 8.4+, with precedence-aware logic - mysql_innodb_redo_logs_not_sized_correctly: remove stray quote breaking the PromQL query
All MongoDB checks errored (previously masked as "exit status 1"). Fixes by group: - Code bugs: mongodb_dbpath_mount (// comments -> #), mongodb_write_tickets_runtime (undefined read_url), mongodb_taskexecutor (value used before assignment), mongodb_cpucores (num_cpus renamed to num_logical_cores; guard version-specific URL), mongodb_version / mongodb_cve_version (guard version maps for untracked releases like 8.2), mongodb_authmech_scramsha256 (getParameter has no 'parsed'; fix misspelled key) - Replica-set/sharding checks now no-op gracefully on a standalone instead of crashing on absent keys (mongodb_cache_size, mongodb_multiple_services, mongodb_psa_architecture_check, mongodb_oplog_size_recommendation, mongodb_collection_fragmented, mongodb_balancer, mongodb_shard_collection_inconsistent_indexes) - mongodb_replicaset_topology, mongodb_replication_lag: source replSetGetStatus from getDiagnosticData (standalone-tolerant) instead of the replSetGetStatus command that errors with NoReplicationEnabled Verified against a standalone MongoDB 8.2.6: all 16 now complete (ok / graceful skip). Replica-set/sharded finding logic is unchanged but not exercised on this topology.
…isor-ux # Conflicts: # api/descriptor.bin # ui/apps/pmm/src/router.tsx
…improve PostgreSQL extension check variable naming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ticket number: PMM-14109
Feature build: SUBMODULES-4438