Class: Necropsy::Analyzers::Dynamic::RedisPayloadLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/necropsy/analyzers/dynamic/redis_payload_loader.rb

Constant Summary collapse

DEFAULT_PATTERN =
'coverband*'

Instance Method Summary collapse

Constructor Details

#initialize(source:, config:) ⇒ RedisPayloadLoader

Returns a new instance of RedisPayloadLoader.



17
18
19
20
21
22
# File 'lib/necropsy/analyzers/dynamic/redis_payload_loader.rb', line 17

def initialize(source:, config:)
  @redactor = RedisCredentialRedactor.new(source)
  @uri = parse_uri(source)
  @config = config
  @limits = RedisInputLimits.new(config)
end

Instance Method Details

#loadObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/necropsy/analyzers/dynamic/redis_payload_loader.rb', line 24

def load
  start_session
  transport.connect
  authenticate
  select_database
  payload_processor.merge(keys.filter_map { |key| payload_for_key(key) })
rescue RedisCommandError, Error => e
  raise Error, redactor.redact(e.message), cause: nil
rescue StandardError => e
  raise Error, redactor.redact("Could not load Redis coverage: #{e.message}"), cause: nil
ensure
  transport&.close
end