Add backfill worker for CodeSuggestionsUsage
What does this MR do and why?
This worker will be used to copy data from PG to ClickHouse when instance admin enabled use_clickhouse_for_analytics setting. In scope of this MR we only introduce worker functionality without attaching it to application setting. No user facing changes here.
How to set up and validate locally
- Enable application setting
Gitlab::CurrentSettings.current_application_settings.update(use_clickhouse_for_analytics: true) - Seed
ai_usage_statsfor given projectPROJECT_ID=2 FILTER=ai_usage_stats bundle exec rake db:seed_fu - In Rails console wipe CH usage table:
ClickHouse::Client.execute("ALTER TABLE code_suggestion_usages DELETE WHERE 1=1", :main) - In Rails console run the worker:
Analytics::CodeSuggestionsUsageBackfillWorker.new.handle_event(nil) - Verify that data is present in CH:
ClickHouse::Client.select("SELECT * FROM code_suggestion_usages WHERE 1=1", :main)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #523404
Edited by Pavel Shutsin