Skip to content

PMM-14109 Improve Advisor UX#5656

Draft
ademidoff wants to merge 69 commits into
mainfrom
PMM-14109-improve-advisor-ux
Draft

PMM-14109 Improve Advisor UX#5656
ademidoff wants to merge 69 commits into
mainfrom
PMM-14109-improve-advisor-ux

Conversation

@ademidoff

Copy link
Copy Markdown
Member

Ticket number: PMM-14109

Feature build: SUBMODULES-4438

ademidoff and others added 30 commits June 27, 2026 10:53
- 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.
…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
ademidoff and others added 6 commits July 16, 2026 17:37
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
ademidoff temporarily deployed to PMM-14109-improve-advisor-ux - pmm-doc-3 PR #5656 July 21, 2026 21:06 — with Render Destroyed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant