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::EphemeralData at BulkImports::CreateService time; read from BulkImports::Entity when the start events fire.
  • Standard importers inheriting Import::BaseService (GitHub, Gitea, Bitbucket, Bitbucket Server, Fogbugz): the calling controller or API endpoint sets request_channel= on the service, which stashes it in the request store via Gitlab::Import::RequestChannel.stash; ProjectImportState reads it with .stashed in an after_create callback and writes it to Redis; it's read back when start_project_import fires.
  • GroupImportState doesn't capture request_channel yet; 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

  1. Enable Snowplow Micro:

    gdk config set snowplow_micro.enabled true
    gdk reconfigure && gdk restart
  2. Watch http://gdk.test:9091/micro/good.

  3. 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".
  4. Confirm start_project_import / start_group_import carry request_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)

Edited by Carla Drago

Merge request reports

Loading
Loading