Track request_channel on import lifecycle events
What does this MR do and why?
Adds request_channel (api / ui / congregate) as an additional property on the project and group import start events, so imports can be broken down by how they were started. Congregate is a Professional Services migration tool that calls the API; it's identified by its GitLabApiClient User-Agent.
request_channel is only sent on start_project_import and start_group_import. The channel can't change partway through an import, and for project imports the value is held in a Redis cache that expires after 24 hours, so a long-running import could lose it by the time its later events fire.
Implementation
Two capture paths, both write to Redis via Gitlab::Cache::Import::Caching — no new columns, matching the pattern used by this MR.
- Direct Transfer / Offline Transfer: captured in
Import::BulkImports::EphemeralDataatBulkImports::CreateServicetime; read fromBulkImports::Entitywhen the start events fire. - Standard importers inheriting
Import::BaseService(GitHub, Gitea, Bitbucket, Bitbucket Server, Fogbugz): the calling controller or API endpoint setsrequest_channel=on the service, which stashes it in the request store viaGitlab::Import::RequestChannel.stash;ProjectImportStatereads it with.stashedin anafter_createcallback and writes it to Redis; it's read back whenstart_project_importfires. GroupImportStatedoesn't capturerequest_channelyet; file-based group import is covered by the follow-up.
Detection helper: Gitlab::Import::RequestChannel.detect(request) returns :congregate for the GitLabApiClient UA, :api otherwise. Controllers pass :ui explicitly.
Deliberately not added to *_gitlab_migration_entity events per the design in #617884.
Scope
- Part of #617884.
- Closes #627877 (closed).
- Follow-up #630178 (closed) covers the remaining importers that don't inherit
Import::BaseService(Bitbucket UI controller, Manifest, Git URL, file-based project/group).
How to validate locally
-
Enable Snowplow Micro:
gdk config set snowplow_micro.enabled true gdk reconfigure && gdk restart -
Start imports through each channel:
- UI: any importer via New Project → Import.
- API:
curl -H "PRIVATE-TOKEN: <pat>" -X POST http://gdk.test:3000/api/v4/import/github .... - Congregate: same, adding
-H "User-Agent: GitLabApiClient".
-
Confirm
start_project_import/start_group_importcarryrequest_channel: 'ui'/'api'/'congregate', and that the finish/fail/cancel/timeout events don't.
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 #627877 (closed)