Skip to content

Initialize new product analytics stack via GraphQL

Max Woolf requested to merge 382859-stack-initialization-status into master

What does this MR do and why?

  • Adds a new GraphQL mutation: projectInitializeProductAnalytics which attempts to initialize the product analytics tooling for an individual project.
  • The job will be attempted 4 times before failing, and allowing the user to trigger the process again.
  • We're using a custom way of deduplicating using redis keys rather than :until_executed so that the frontend can know if a job is currently in progress. (I'm open to better ways to achieve this!)

Screencast

See demonstration: https://youtu.be/NCkbsPHWYtg

How to set up and validate locally

  1. Enable the feature flag: echo "Feature.enable(:cube_api_proxy)" | rails c.
  2. Set up the devkit and start it running using docker-compose up.
  3. Visit admin settings and make sure that the settings have been set: /admin/application_settings/general#js-product-analytics-settings
  4. As an authenticated user who has developer+ access to a particular project, make the following GraphQL call:
mutation {
  projectInitializeProductAnalytics(input: { projectPath: "flightjs/project_twenty" }) {
    project {
      fullPath
    }
    errors
  }
}
  1. Assert that a new background job has been created.
  2. Assert that a new connection is created in jitsu.

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

Edited by Max Woolf

Merge request reports