lib/raven/integrations/sidekiq.rb in sentry-raven-2.7.1 vs lib/raven/integrations/sidekiq.rb in sentry-raven-2.7.2
- old
+ new
@@ -12,10 +12,11 @@
end
end
class SidekiqErrorHandler
ACTIVEJOB_RESERVED_PREFIX = "_aj_".freeze
+ HAS_GLOBALID = const_defined?('GlobalID')
def call(ex, context)
context = filter_context(context)
Raven.context.transaction.push transaction_from_context(context)
Raven.capture_exception(
@@ -40,11 +41,11 @@
when Array
context.map { |arg| filter_context(arg) }
when Hash
Hash[context.map { |key, value| filter_context_hash(key, value) }]
else
- context
+ format_globalid(context)
end
end
def filter_context_hash(key, value)
(key = key[3..-1]) if key [0..3] == ACTIVEJOB_RESERVED_PREFIX
@@ -61,9 +62,17 @@
"Sidekiq/#{classname}"
elsif context[:event]
"Sidekiq/#{context[:event]}"
else
"Sidekiq"
+ end
+ end
+
+ def format_globalid(context)
+ if HAS_GLOBALID && context.is_a?(GlobalID)
+ context.to_s
+ else
+ context
end
end
end
end