Skip to content

Add queryOverrides field to product analytics dashboards panels

What does this MR do and why?

This MR adds the missing GraphQL queryOverrides field to product analytics dashboards panels to resolve The product analytics panel query does not retu... (#415563 - closed).

Note that shared analytics dashboard is hidden behind a default off feature flag.

Query example

query {
  project(fullPath: "gitlab-org/snowplow2") {
    name
    productAnalyticsDashboards(slug: "something") {
      nodes {
        slug
        panels {
          nodes {
            title
            queryOverrides
          }
        }
      }
    }
  }
}
{
  "data": {
    "project": {
      "name": "Snowplow2",
      "productAnalyticsDashboards": {
        "nodes": [
          {
            "slug": "something",
            "panels": {
              "nodes": [
                {
                  "title": "Page views over time",
                  "queryOverrides": [
                    {
                      "timeDimensions": [
                        {
                          "dimension": "SnowplowTrackedEvents.derivedTstamp",
                          "granularity": "week"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  }
}

How to set up and validate locally

  1. Make sure you are on GitLab Ultimate
  2. Follow these instructions to set up Product Analytics in your GDK.
    • Import to also enable both the product_analytics_snowplow_support feature flag.
  3. Create a new project with an empty repository.
  4. Enable custom dashboards at Project > Settings > Analytics and pick the empty project.
  5. Create a custom dashboard by following these instructions with the contents below:
  6. Query the GraphQL API with the example query above and replace the project with your custom dashboard project path.
---
version: 1
title: Something
description: All insights on user activity
panels:
  - id: 1
    visualization: page_views_over_time
    title: Page views over time
    gridAttributes:
      yPos: 1
      xPos: 0
      width: 6
      height: 5
    options: {}
    queryOverrides:
      - timeDimensions:
        - dimension: SnowplowTrackedEvents.derivedTstamp
          granularity: week

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 #415563 (closed)

Edited by Jiaan Louw

Merge request reports

Loading