Skip to content

Commit

Permalink
Add Falcon as recognized server
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannah Ramadan committed Dec 19, 2023
1 parent b59d82a commit ebc74b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/new_relic/agent/agent_helpers/special_startup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions lib/new_relic/local_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def discover_dispatcher
unicorn
webrick
fastcgi
falcon
]
while dispatchers.any? && @discovered_dispatcher.nil?
send('check_for_' + (dispatchers.shift))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ebc74b5

Please sign in to comment.