Draft: Validate collector host when product analytics enabled
What does this MR do and why?
NOTE: This MR will be merged only after backfill migration is run in production.
Application settings jitsu_host
and collector_host
should be stored separately. However, currently we only store jitsu_host
and calculate the collector_host
based on jitsu_host
.
Recently, we added a new product_analytics_data_collector_host
to application_settings
table to store the above-mentioned collector host. We're backfilling the values with a post-migration.
This current MR is adding a validation on the presence and URL format.
How to set up and validate locally
In rails console
- Initialise an
ApplicationSetting
instance withproduct_analytics_enabled
a = ApplicationSetting.new(product_analytics_enabled: true)
- It should not be valid
a.valid? # should be false
- It should have error for
product_analytics_data_collector_host
a.errors[:product_analytics_data_collector_host] # it should give ["must be a valid URL", "can't be blank"]
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #389490 (closed)
Edited by Halil Coban