GitHub - Track imports via UI versus API
To improve imports observability, we could add an import_origin column to the projects table, and start recording whether an import is initiated via ui or api. This in combination with the existing import_type column could be useful for metrics.
Options
- Adding columns to the db table OR
- Using internal events https://docs.gitlab.com/development/internal_analytics/internal_event_instrumentation/
NOTE: Unfortunately we won't be able to add to the projects table, so option 2 might be better.
Tasks (if implementing Option 1)
Database migration:
- Add import_origin column to projects table
- Type: string (nullable, no default)
- Expected values: 'ui', 'api', NULL (for existing/unknown)
app/services/import/github_service.rb
- Modify execute method to accept origin parameter
- Pass origin through to project creation
lib/gitlab/legacy_github_import/project_creator.rb
- Accept origin parameter and set it on the project
app/controllers/import/github_controller.rb
- Update create action to pass origin: 'ui' to Import::GithubService
- (Gitea inherits this automatically? Verify this)
lib/api/import_github.rb
- Update post 'import/github' to pass origin: 'api' to Import::GithubService
specs
- Update Import::GithubService specs to verify origin is set
- Update controller specs to verify origin: 'ui' is passed
- Update API specs to verify origin: 'api' is passed
Follow ups
- Direct transfer / bulk imports
- other importers
Edited by Oiza Baiye