Add feature flag and new add-on
What does this MR do and why?
-
Adds a new add-on type product analytics
.- Which can be added to a namespace using the existing add-on REST APIs.
-
Adds a new conusumable type of additional product analytics events
.
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.
How to set up and validate locally
- Set your GDK to SaaS simulation.
- Create a new group, with ultimate subscription.
- Enable the feature flag:
product_analytics_billing
- Make an API call as an instance administrator.
POST /api/v4/namespaces/{GROUP NAME}/subscription_add_on_purchase/product_analytics
{"quantity":"1","expires_on":"2025-01-01","purchase_xid":"ANY STRING"}
- Once successfully run, check that the both the new AddOn and the Purchase was created and assigned to the namespace.
[1] pry(main)> GitlabSubscriptions::AddOn.last
=> #<GitlabSubscriptions::AddOn:0x0000000118136758
id: 7,
created_at: Thu, 11 Jan 2024 14:29:26.691670000 UTC +00:00,
updated_at: Thu, 11 Jan 2024 14:29:26.691670000 UTC +00:00,
name: "product_analytics", <--- make sure this is correct
description: "[FILTERED]">
[2] pry(main)> a = GitlabSubscriptions::AddOnPurchase.last
=> #<GitlabSubscriptions::AddOnPurchase:0x0000000147c50b50
id: 7,
created_at: Thu, 11 Jan 2024 14:29:26.708799000 UTC +00:00,
updated_at: Thu, 11 Jan 2024 14:29:26.708799000 UTC +00:00,
subscription_add_on_id: 7, <--- this ID should match the ID above
namespace_id: 122, <---- this should be your namespace ID
quantity: 1,
expires_on: Wed, 01 Jan 2025,
purchase_xid: "378fsehjf",
last_assigned_users_refreshed_at: nil>
- Running it again should fail with a
400
response. - Run the previous steps again with
product_analytics_allowance
instead. It should be possible to set the quantity to any number.
Related to #437878
Edited by Max Woolf