Sha256: efc91762a00769cf7eabb6b30f0383e25d6a30f3eddca414109355e886bdcd71
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
module Raven module Sidekiq module ContextFilter class << self ACTIVEJOB_RESERVED_PREFIX = "_aj_".freeze HAS_GLOBALID = const_defined?('GlobalID') # Once an ActiveJob is queued, ActiveRecord references get serialized into # some internal reserved keys, such as _aj_globalid. # # The problem is, if this job in turn gets queued back into ActiveJob with # these magic reserved keys, ActiveJob will throw up and error. We want to # capture these and mutate the keys so we can sanely report it. def filter_context(context) case context when Array context.map { |arg| filter_context(arg) } when Hash Hash[context.map { |key, value| filter_context_hash(key, value) }] else format_globalid(context) end end private def filter_context_hash(key, value) (key = key[3..-1]) if key [0..3] == ACTIVEJOB_RESERVED_PREFIX [key, filter_context(value)] end def format_globalid(context) if HAS_GLOBALID && context.is_a?(GlobalID) context.to_s else context end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sentry-raven-3.1.0 | lib/raven/integrations/sidekiq/context_filter.rb |