Improve Analytics dashboards schema errors
What does this MR do and why?
Reinstates !153152 (merged) after it produced a regression in custom dashboards created using the dashboard designer in which the schema errors alert appeared in all of them. It makes several modifications to ensure that all new and existing custom dashboards are compliant with the schema.
Replaces the vague GraphQL error messages returned when an Analytics dashboard configuration is invalid with friendlier error messages from the new errors
field in the CustomizableDashboard
GraphQL object type to display in the UI when they are present. In order to bypass the default GraphQL error handling to display these schema errors, this MR allows any fields coming from the YAML config – specifically from ProductAnalytics::Dashboard
and ProductAnalytics::PanelType
– to be nullable.
This MR also does the following:
- Adds a
Contains errors
badge to any invalid dashboards listed in the Analytics dashboards page. Previously, no error badges were displayed. - Updates all built-in dashboard configurations – Value Streams Dashboard, Behavior, Audience, AI Impact – to ensure that they match the dashboard JSON schema defined in
ee/app/validators/json_schemas/analytics_dashboard.json
. - Ensures that all new custom dashboards are compliant to the schema
- Relaxes the schema a bit by making several fields optional so that the invalid configuration alert does not appear in existing custom dashboards created using the dashboard designer. The fields are:
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
There should be no visual changes in custom dashboards created using the dashboard designer.
View | Before | After |
---|---|---|
Dashboards List | ||
Dashboard |
How to set up and validate locally
For dashboards defined using YAML
-
Please make sure that you have a GitLab Ultimate license.
-
Create a group or select an existing one
-
Follow the instructions to add a YAML configuration for the group and use the example below for your schema:
title: 'Custom Dashboard - Test VSD' description: 'Custom description' panels: - visualization: dora_chart # broken panel - missing `title` and `gridAttributes` queryOverrides: {}
-
Navigate to
Analyze
>Analytics Dashboards
in the left hand menu -
Verify that a
Contains errors
badge should appear next toCustom Dashboard - Test VSD
-
Select
Custom Dashboard - Test VSD
-
Verify that an alert appears listing all of the dashboard schema's errors with a link to the troubleshooting section in the Analytics dashboards doc
For dashboards created using the dashboard designer
- Set up Product Analytics on your machine
- Create a custom dashboard and verify that the invalid configuration alert does not appear
- Edit the custom dashboard you created above and again verify that the invalid configuration alert does not appear
Related to #444915 (closed)