From ebc74b53c76dffa1b3d1ce3520807dde27c3c667 Mon Sep 17 00:00:00 2001 From: Hannah Ramadan Date: Tue, 19 Dec 2023 15:28:04 -0700 Subject: [PATCH] Add Falcon as recognized server --- lib/new_relic/agent/agent_helpers/special_startup.rb | 2 +- lib/new_relic/local_environment.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/new_relic/agent/agent_helpers/special_startup.rb b/lib/new_relic/agent/agent_helpers/special_startup.rb index 08b5d4cf33..351967636e 100644 --- a/lib/new_relic/agent/agent_helpers/special_startup.rb +++ b/lib/new_relic/agent/agent_helpers/special_startup.rb @@ -10,7 +10,7 @@ module SpecialStartup # requests, we need to wait until the children are forked # before connecting, otherwise the parent process sends useless data def using_forking_dispatcher? - if [:puma, :passenger, :unicorn].include?(Agent.config[:dispatcher]) + if [:puma, :passenger, :unicorn, :falcon].include?(Agent.config[:dispatcher]) ::NewRelic::Agent.logger.info('Deferring startup of agent reporting thread because ' \ "#{Agent.config[:dispatcher]} may fork.") true diff --git a/lib/new_relic/local_environment.rb b/lib/new_relic/local_environment.rb index dff2d8343f..87d5f56fb9 100644 --- a/lib/new_relic/local_environment.rb +++ b/lib/new_relic/local_environment.rb @@ -74,6 +74,7 @@ def discover_dispatcher unicorn webrick fastcgi + falcon ] while dispatchers.any? && @discovered_dispatcher.nil? send('check_for_' + (dispatchers.shift)) @@ -138,6 +139,12 @@ def check_for_puma end end + def check_for_falcon + if defined?(::Falcon::Server) && File.basename($0) == 'falcon' + @discovered_dispatcher = :falcon + end + end + def check_for_delayed_job if $0 =~ /delayed_job$/ || (File.basename($0) == 'rake' && ARGV.include?('jobs:work')) @discovered_dispatcher = :delayed_job