22 lines
587 B
Ruby
22 lines
587 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module ExceptionLogFormatter
|
|
def self.format!(exception, payload)
|
|
return unless exception
|
|
|
|
# Elasticsearch/Fluentd don't handle nested structures well.
|
|
# Use periods to flatten the fields.
|
|
payload.merge!(
|
|
'exception.class' => exception.class.name,
|
|
'exception.message' => exception.message
|
|
)
|
|
|
|
payload.delete('extra.server')
|
|
|
|
if exception.backtrace
|
|
payload['exception.backtrace'] = Gitlab::BacktraceCleaner.clean_backtrace(exception.backtrace)
|
|
end
|
|
end
|
|
end
|
|
end
|