require 'sqreen/ecosystem/module_api' require 'sqreen/ecosystem/module_api/instrumentation' require 'sqreen/ecosystem/module_api/message_producer' require 'sqreen/ecosystem/databases/database_connection_data' module Sqreen module Ecosystem module Databases class Redis include ModuleApi::Instrumentation include ModuleApi::MessageProducer def setup advice = wrap_for_interest(DatabaseConnectionData, &method(:after_advice)) instrument 'Redis#initialize', after: advice end private # @param [Sqreen::Graft::CallbackCall] call def after_advice(call, _ball) return if call.raised conn = call.instance.connection DatabaseConnectionData.new( transport: :redis, host: conn[:host], port: conn[:port], db: conn[:db].to_s, ) end end end end end