# typed: ignore # Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html module Sqreen module Dependency module NewRelic module_function def bundled? defined?(Gem) && Gem.respond_to?(:loaded_specs) && !Gem.loaded_specs['newrelic_rpm'].nil? end def required? Sqreen::Dependency.const_exist?('NewRelic::Agent::Agent') end def ignore_sqreen_exceptions return unless required? ::NewRelic::Agent::Agent.instance.error_collector.ignore(['Sqreen::AttackBlocked']) rescue ::Exception => e # rubocop:disable Lint/RescueException Sqreen.log.warn "Failed ignoring AttackBlocked on NewRelic: #{e.inspect}" end end end end