Commit bf07bb2d authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch 'kassio/github-importer-better-logging-key-name' into 'master'

Rename `GitlabImport::Logger` `import_source` key to `import_type`

See merge request gitlab-org/gitlab!67726
parents 6e9cc5c6 4f5db8c1
......@@ -238,9 +238,10 @@ The code for this resides in:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48512/diffs) in GitLab 13.7.
> - Number of imported objects [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64256) in GitLab 14.1.
> - `Gitlab::GithubImport::Logger` [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65968) in GitLab 14.2.
> - `import_source` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67726) to `import_type` in GitLab 14.2.
The import progress can be checked in the `logs/importer.log` file. Each relevant import is logged
with `"import_source": "github"` and the `"project_id"`.
with `"import_type": "github"` and the `"project_id"`.
The last log entry reports the number of objects fetched and imported:
......
......@@ -44,7 +44,7 @@ module Gitlab
def log_and_increment_counter(value, operation)
Gitlab::Import::Logger.info(
import_source: :github,
import_type: :github,
project_id: project.id,
importer: self.class.name,
message: "#{value} #{object_type.to_s.pluralize} #{operation}"
......
......@@ -4,7 +4,7 @@ module Gitlab
module GithubImport
class Logger < ::Gitlab::Import::Logger
def default_attributes
super.merge(import_source: :github)
super.merge(import_type: :github)
end
end
end
......
......@@ -36,7 +36,7 @@ RSpec.describe Gitlab::GithubImport::BulkImporting do
expect(Gitlab::Import::Logger)
.to receive(:info)
.with(
import_source: :github,
import_type: :github,
project_id: 1,
importer: 'MyImporter',
message: '1 object_types fetched'
......@@ -70,7 +70,7 @@ RSpec.describe Gitlab::GithubImport::BulkImporting do
expect(Gitlab::Import::Logger)
.to receive(:info)
.with(
import_source: :github,
import_type: :github,
project_id: 1,
importer: 'MyImporter',
message: '0 object_types fetched'
......@@ -100,7 +100,7 @@ RSpec.describe Gitlab::GithubImport::BulkImporting do
.to receive(:info)
.twice
.with(
import_source: :github,
import_type: :github,
project_id: 1,
importer: 'MyImporter',
message: '5 object_types imported'
......
......@@ -21,7 +21,7 @@ RSpec.describe Gitlab::GithubImport::Logger do
'message' => 'Hello world',
'correlation_id' => 'new-correlation-id',
'feature_category' => 'importers',
'import_source' => 'github'
'import_type' => 'github'
})
end
......@@ -34,7 +34,7 @@ RSpec.describe Gitlab::GithubImport::Logger do
'hello' => 1,
'correlation_id' => 'new-correlation-id',
'feature_category' => 'importers',
'import_source' => 'github'
'import_type' => 'github'
})
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment