lib/sidekiq/logging/shared.rb in sidekiq-logstash-1.2.0 vs lib/sidekiq/logging/shared.rb in sidekiq-logstash-1.2.1
- old
+ new
@@ -86,15 +86,15 @@
# If encrypt is true, the last arg is encrypted so hide it
payload['args'][-1] = ENCRYPTED if payload['encrypt']
# Needs to map all args to strings for ElasticSearch compatibility
- payload['args'].map!(&:to_s)
+ deep_stringify!(payload['args'])
# Needs to map all unique_args to strings for ElasticSearch
# compatibility in case sidekiq-unique-jobs is used
- payload['unique_args']&.map!(&:to_s)
+ deep_stringify!(payload['unique_args'])
if payload['retry'].is_a?(Integer)
payload['max_retries'] = payload['retry']
payload['retry'] = true
end
@@ -121,9 +121,20 @@
timestamp
end
def filter_args
Sidekiq::Logstash.configuration.filter_args
+ end
+
+ def deep_stringify!(args)
+ case args
+ when Hash
+ Hash[args.map { |key, value| [deep_stringify!(key), deep_stringify!(value)] }]
+ when Array
+ args.map! { |val| deep_stringify!(val) }
+ else
+ args.to_s
+ end
end
end
end
end