Skip to content

Initialize product analytics stack via GraphQL mutation

Overview

Currently the only way to initialize the product analytics stack for a project is to manually call the ProductAnalytics::InitializeStackService service from the rails console.

We need a way for an API consumer to trigger the service idempotently.

Implementation plan

  • Before enqueuing the stack initialization worker, populate a redis key project_{ID}_product_analytics_stack_initializing = true. Include an expiry.
  • On completion (or failure) delete the redis key.
  • Create graphql mutation to execute InitializeStackService. Returns the state of the analytics stack. (Enqueued or error)