Commit 87e03ee8 authored by Kassio Borges's avatar Kassio Borges

Do not filter the relation name on import failures

Fields that end with `key` are filtered out of the logs, for security
reasons. To avoid filtering the `relation_key` on import failures use
`relation_name` which is semantically equivalent and does not get
filtered.
parent 865ce25b
......@@ -28,23 +28,26 @@ module Gitlab
end
def log_import_failure(source:, relation_key: nil, relation_index: nil, exception:, retry_count: 0)
extra = {
source: source,
relation_key: relation_key,
attributes = {
relation_index: relation_index,
retry_count: retry_count
source: source,
retry_count: retry_count,
importable_column_name => importable.id
}
extra[importable_column_name] = importable.id
Gitlab::ErrorTracking.track_exception(exception, extra)
attributes = {
exception_class: exception.class.to_s,
exception_message: exception.message.truncate(255),
correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id
}.merge(extra)
ImportFailure.create(attributes)
Gitlab::ErrorTracking.track_exception(
exception,
attributes.merge(relation_name: relation_key)
)
ImportFailure.create(
attributes.merge(
exception_class: exception.class.to_s,
exception_message: exception.message.truncate(255),
correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id,
relation_key: relation_key
)
)
end
private
......
......@@ -3,10 +3,10 @@
RSpec.shared_examples 'log import failure' do |importable_column|
it 'tracks error' do
extra = {
source: action,
relation_key: relation_key,
relation_index: relation_index,
retry_count: retry_count
source: action,
relation_name: relation_key,
relation_index: relation_index,
retry_count: retry_count
}
extra[importable_column] = importable.id
......
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