Skip to content

Validate visualizations and provide errors via GraphQL

What does this MR do and why?

Adds backend validation of custom product analytics visualizations

How to set up and validate locally

  1. Setup the product analytics devkit according to the instructions
  2. Setup product analytics for your project according to the devkit instructions
  3. Setup a custom visualization for the project, and make it invalid according to the schema
  4. Setup a dashboard to use this custom visualization (one of the panels should have the invalid visualization you just created, i.e. visualization: example_invalid_custom_visualization)
  5. Query GraphQL for any errors associated with the visualization, you should see your schema validation errors under the errors property

Invalid Visualization example

---
version: 1
type: DoesNotExistType
data:
  type: cube_analytics
  query:
    measures:
      - SnowplowTrackedEvents.uniqueUsersCount
    limit: 100
    timezone: UTC
    filters: []
    dimensions: []
    timeDimensions: []
options: {}

Example GraphQL Query

      query {
        project(fullPath: "PROJECT_FULL_PATH") {
          productAnalyticsDashboards {
            nodes {
              panels {
                nodes {
                  visualization {
                    errors
                  }
                }
              }
            }
          }
        }
      }

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #420684 (closed)

Edited by Allen Cook

Merge request reports