Skip to content

Add support for dynamic schemas with date range filters

What does this MR do and why?

This MR updates the date range filter mapping logic so we can support dynamic schemas (such as funnels or custom events). In the event that our map doesn't find a matching table name, it will fall back to using the date field rather than a bespoke field for the table. We control the schema structure for dynamic schemas, so we can easily enforce the date field requirement. We already do so for funnels.

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

Before After
image image

How to set up and validate locally

  1. Enable Product analytics on your GDK by following the instructions.
  2. Navigate to Project > Analytics > Analytics dashboards and set up product analytics.
  3. Navigate to Project > Analytics > Analytics dashboards and click on the alert CTA to enable custom dashboards.
  4. Create a new funnel. As an example:
    # .gitlab/analytics/funnels/dashboard_usage.yaml
    name: Dashboard Usage
    seconds_to_convert: 3600
    steps:
    - name: view_dashboards_list
      target: '/gitlab-org/gdk-tracking/-/analytics/dashboards'
      action: 'pageview'
    - name: view_all_the_things_dashboard
      target: '/gitlab-org/gdk-tracking/-/analytics/dashboards/all_the_things'
      action: 'pageview'
  5. Create a visualization using the new funnel. As an example:
    # .gitlab/analytics/dashboards/visualizations/funnel_test.yaml
    version: 1
    type: ColumnChart
    data:
      type: cube_analytics
      query:
        measures:
        - dashboard_usage.count
        dimensions:
        - dashboard_usage.step
        limit: 100
        timezone: UTC
        timeDimensions: []
    options:
      xAxis:
        name: Step
        type: category
      yAxis:
        name: Total
        type: value
  6. Create or add your new visualization to a custom dashboard.
  7. Verify that the visualization renders and supports changing the date range.

Related to #437644 (closed)

Edited by Jiaan Louw

Merge request reports