Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Falcon instrumentation #2383

Merged
merged 5 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## v9.7.0

Version 9.7.0 changes the endpoint used to access the cluster name for Elasticsearch instrumentation.
Version 9.7.0 changes the endpoint used to access the cluster name for Elasticsearch instrumentation and adds support for Falcon.

- **Feature: Use root path to access Elasticsearch cluster name**

Expand All @@ -18,6 +18,10 @@ Version 9.7.0 changes the endpoint used to access the cluster name for Elasticse

Thank you, [@Earlopain](https://github.com/Earlopain), for submitting this change. [PR#2378](https://github.com/newrelic/newrelic-ruby-agent/pull/2378)

- **Feature: Add Falcon support**

The agent now supports the web server [Falcon](https://socketry.github.io/falcon/). [PR#2383](https://github.com/newrelic/newrelic-ruby-agent/pull/2383)

## v9.6.0

Version 9.6.0 adds instrumentation for Async::HTTP, Ethon, and HTTPX, adds the ability to ignore specific routes with Roda, gleans Docker container IDs from cgroups v2-based containers, records additional synthetics attributes, fixes an issue with Rails 7.1 that could cause duplicate log records to be sent to New Relic, fixes a deprecation warning for the Sidekiq error handler, adds additional attributes for OpenTelemetry compatibility, and resolves some technical debt, thanks to the community.
Expand Down
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])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falcon was added to this list because of its ability to fork. Falcon can also run in a threaded mode instead of a forking one, but given that:

There is no guarantee that your process would be forked or threaded.

socketry/falcon#53 (comment)

It makes sense to always defer when Falcon is in play.

::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) && NewRelic::LanguageSupport.object_space_usable?
@discovered_dispatcher = :falcon if find_class_in_object_space(::Falcon::Server)
end
hannahramadan marked this conversation as resolved.
Show resolved Hide resolved
end

def check_for_delayed_job
if $0 =~ /delayed_job$/ || (File.basename($0) == 'rake' && ARGV.include?('jobs:work'))
@discovered_dispatcher = :delayed_job
Expand Down
Loading