Skip to content

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:
    • version (to be updated in #466598)
    • queryOverrides.gridAttributes.xPos (since dashboards without rearranged panels don't contain coordinates – to be addressed in #466157)
    • queryOverrides.gridAttributes.yPos (same as above)

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 Screenshot 2024-05-15 at 1.27.21 PM.png Screenshot 2024-05-15 at 1.30.05 PM.png
Dashboard Screenshot 2024-05-15 at 1.27.29 PM.png Screenshot 2024-05-15 at 1.29.47 PM.png

How to set up and validate locally

For dashboards defined using YAML

  1. Please make sure that you have a GitLab Ultimate license.

  2. Create a group or select an existing one

  3. 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: {}
  4. Navigate to Analyze > Analytics Dashboards in the left hand menu

  5. Verify that a Contains errors badge should appear next to Custom Dashboard - Test VSD

  6. Select Custom Dashboard - Test VSD

  7. 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

  1. Set up Product Analytics on your machine
  2. Create a custom dashboard and verify that the invalid configuration alert does not appear
  3. Edit the custom dashboard you created above and again verify that the invalid configuration alert does not appear

Related to #444915 (closed)

Edited by Rudy Crespo

Merge request reports