Skip to content

Refactor to retrieve product analytics router base URI from HAML

What does this MR do and why?

This MR moves the retrieval of the router base from the dynamic URI and regex, to a fixed value provided by HAML. This approach produces a far more stable–and reliable–output.

Screenshots or screen recordings

Screen_Recording_2023-01-16_at_12.15.04

How to set up and validate locally

Follow the instructions at https://gitlab.com/gitlab-org/gitlab/-/snippets/2474959 to enable Product Analytics on your GDK.

Having followed the steps above, you will next need to set up a dashboard (if you don't already have one):

  1. Initialize the stack for a new project on the Rails console (rails c):

    project = Project.find_by_id(1)
    ProductAnalytics::InitializeStackService.new(container: project).execute
    # Expected response:
    # <ServiceResponse:0x00000001621a6db0 @http_status=:ok, @message="Product analytics initialization started", @payload={}, @reason=nil, @status=:success>
  2. Go to /gitlab-org/gitlab-test/-/product_analytics/dashboards.

  3. The setup page should render as there is no data for Cube.js yet.

  4. Insert data into the instrumented project by following the DevKit instructions for the new project. Or copy the data from another project directly without instrumenting:

    -- In ClickHouse
    CREATE TABLE gitlab_project_1.jitsu AS gitlab_project_2.jitsu;
    INSERT INTO gitlab_project_1.jitsu SELECT * FROM gitlab_project_2.jitsu LIMIT 1;
  5. The dashboard page should be rendered automatically.

  6. After reloading, the dashboard page should be rendered.

Now to test this MR:

  1. Visit the dashboards page e.g. /gitlab-org/gitlab-test/-/product_analytics/dashboards.
  2. Select different dashboards and navigate back to the overview.
  3. Confirm that the different views are shown and that the URLs are updated appropriately.

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

Edited by Robert Hunt

Merge request reports

Loading