Commit 7cd88c54 authored by Stan Hu's avatar Stan Hu Committed by James Fargher

Use error.message instead of error in importer.log

Elasticsearch expects `error` to be an object representing the
exception. Rename the field to `error.message` to avoid parsing
conflicts.
parent eb8c2f47
...@@ -26,7 +26,7 @@ module Projects ...@@ -26,7 +26,7 @@ module Projects
message: 'Project housekeeping failed', message: 'Project housekeeping failed',
project_full_path: @project.full_path, project_full_path: @project.full_path,
project_id: @project.id, project_id: @project.id,
error: e.message 'error.message' => e.message
) )
end end
......
---
title: Use error.message instead of error in importer.log
merge_request: 36104
author:
type: fixed
...@@ -72,6 +72,26 @@ RSpec.describe Projects::AfterImportService do ...@@ -72,6 +72,26 @@ RSpec.describe Projects::AfterImportService do
end end
end end
context 'when housekeeping service lease is taken' do
let(:exception) { Projects::HousekeepingService::LeaseTaken.new }
it 'logs the error message' do
allow_next_instance_of(Projects::HousekeepingService) do |instance|
expect(instance).to receive(:execute).and_raise(exception)
end
expect(Gitlab::Import::Logger).to receive(:info).with(
{
message: 'Project housekeeping failed',
project_full_path: project.full_path,
project_id: project.id,
'error.message' => exception.to_s
}).and_call_original
subject.execute
end
end
context 'when after import action throw retriable exception one time' do context 'when after import action throw retriable exception one time' do
let(:exception) { GRPC::DeadlineExceeded.new } let(:exception) { GRPC::DeadlineExceeded.new }
......
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