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

NoMethodError in latest version undefined method 'transaction_name' #2166

Closed
spickermann opened this issue Aug 16, 2023 · 9 comments
Closed
Labels
bug community To tag external issues and PRs submitted by the community

Comments

@spickermann
Copy link

Description

I updated our application from 9.3.1 to 9.4.0 this morning and we immediately observed

NoMethodError undefined method `transaction_name' for 
NewRelic::Agent::Instrumentation::ControllerInstrumentation::TransactionNamer:Class

Expected Behavior

I expect no exception at this point. Downgrading the agent to 9.3.1 fixed the issue.

stacktrace

_roda_handle_main_route_with_tracing(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/roda/instrumentation.rb:44)
_roda_handle_main_route(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/roda/prepend.rb:11)
block in base_rack_app_callable(/app/vendor/bundle/ruby/3.2.0/gems/roda-3.67.0/lib/roda.rb:380)
traced_call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/rack/agent_hooks.rb:30)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
traced_call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/rack/browser_monitoring.rb:38)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/roda-3.67.0/lib/roda.rb:53)
call(/app/vendor/bundle/ruby/3.2.0/gems/uppy-s3_multipart-1.2.1/lib/uppy/s3_multipart/app.rb:20)
block in <class:Constraints>(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/routing/mapper.rb:19)
serve(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/routing/mapper.rb:48)
block in serve(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/journey/router.rb:50)
each(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/journey/router.rb:32)
serve(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/journey/router.rb:32)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/routing/route_set.rb:852)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
traced_call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/rack/agent_hooks.rb:30)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
traced_call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/rack/browser_monitoring.rb:38)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/tempfile_reaper.rb:15)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/etag.rb:27)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/conditional_get.rb:40)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/head.rb:12)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/http/permissions_policy.rb:38)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
context(/app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:266)
call(/app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:260)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/middleware/cookies.rb:704)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
block in call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/middleware/callbacks.rb:27)
run_callbacks(/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.6/lib/active_support/callbacks.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/middleware/callbacks.rb:26)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
block in call(/app/vendor/bundle/ruby/3.2.0/gems/rollbar-3.4.0/lib/rollbar/middleware/rails/rollbar.rb:25)
scoped(/app/vendor/bundle/ruby/3.2.0/gems/rollbar-3.4.0/lib/rollbar.rb:145)
call(/app/vendor/bundle/ruby/3.2.0/gems/rollbar-3.4.0/lib/rollbar/middleware/rails/rollbar.rb:22)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/middleware/debug_exceptions.rb:28)
call_with_rollbar(/app/vendor/bundle/ruby/3.2.0/gems/rollbar-3.4.0/lib/rollbar/middleware/rails/show_exceptions.rb:22)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/middleware/show_exceptions.rb:29)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call_app(/app/vendor/bundle/ruby/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/rack/logger.rb:45)
call(/app/vendor/bundle/ruby/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/rack/logger.rb:28)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
call(/app/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.6/lib/action_dispatch/middleware/remote_ip.rb:93)
call(/app/vendor/bundle/ruby/3.2.0/gems/newrelic_rpm-9.4.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99)
[...]

Steps to Reproduce

We have a pretty basic Ruby on Rails application. Please note that the stack trace seems to point at the Roda agent, which was introduced in this PR.

We only use Roda as a dependency of the uppy-s3_multipart gem. The error occurs when there is a POST request to the /s3/multipart route that provided by the gem.

Because we only updated the newrelic_rpm gem in the deploy we are quite sure that the bug was introduced by the newrelic_rpm gem and very likely by the PR mentioned above.

Your Environment

We are running rails 7.0.6, uppy-s3_multipart 1.2.1 and observed the bug only after updating to newrelic_rpm 9.4.0 (9.3.1 was working fine).

For Maintainers Only or Hero Triaging this bug

Suggested Priority (P1,P2,P3,P4,P5):
Suggested T-Shirt size (S, M, L, XL, Unknown):

@workato-integration
Copy link

@github-actions github-actions bot added the community To tag external issues and PRs submitted by the community label Aug 16, 2023
@ColinOrr
Copy link

I'm seeing the same issue for multipart upload requests. I'm also using the uppy-s3_multipart gem v1.2.1.

@tannalynn
Copy link
Contributor

Thanks for bringing this to our attention!
This issue didn't happen during our testing with roda, but we did not test with the uppy-s3_multipart gem. The namespace issue was corrected with #2167, and we just released 9.4.1 with that fix. That should resolve this error. Please let us know if you run into any issues with this fix.

@github-project-automation github-project-automation bot moved this from Triage to Code Complete/Done in Ruby Engineering Board Aug 16, 2023
@ColinOrr
Copy link

Hey @tannalynn thanks for looking into this.

Unfortunately now I get a different error after upgrading to v9.4.1:

Error message:

uninitialized constant NewRelic::Agent::Instrumentation::Roda::TransactionNamer
Did you mean? NewRelic::Agent::TransactionSampler

Stacktrace:
/usr/local/bundle/gems/newrelic_rpm-9.4.1/lib/new_relic/agent/instrumentation/roda/instrumentation.rb:44:in `_roda_handle_main_route_with_tracing'
/usr/local/bundle/gems/newrelic_rpm-9.4.1/lib/new_relic/agent/instrumentation/roda/prepend.rb:11:in `_roda_handle_main_route'
/usr/local/bundle/gems/roda-3.61.0/lib/roda.rb:380:in `block in base_rack_app_callable'
/usr/local/bundle/gems/newrelic_rpm-9.4.1/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
/usr/local/bundle/gems/newrelic_rpm-9.4.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
/usr/local/bundle/gems/newrelic_rpm-9.4.1/lib/new_relic/rack/browser_monitoring.rb:38:in `traced_call'
/usr/local/bundle/gems/newrelic_rpm-9.4.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
/usr/local/bundle/gems/roda-3.61.0/lib/roda.rb:53:in `call'
/usr/local/bundle/gems/uppy-s3_multipart-1.2.1/lib/uppy/s3_multipart/app.rb:20:in `call'

I've been able to work around this by explicitly requiring the RodaTransactionNamer in the Uppy initializer:

require 'new_relic/agent/instrumentation/roda/roda_transaction_namer'

So, maybe you're just missing a require in the NewRelic Agent code?

@spickermann
Copy link
Author

I can confirm, I am observing the same exception when trying out the 9.4.1 version of this gem.

@tannalynn
Copy link
Contributor

Thank you for letting us know this is still not working correctly.

That's surprising to us that adding a require solved the issue. The agent programmatically loads the instrumentation files, which should include this roda file. We double checked this morning and this is working as expected when running a simple roda app, and the file is loaded by that code. It's not clear why this would be different when using the uppy-s3_multipart gem, but we don't currently have any test apps set up using this gem.

Before we release this change, we'd appreciate feedback on if this branch works correctly for you. Since we don't have a test app set up that uses the uppy-s3_multipart gem, we haven't been able to reproduce the issue yet, and we want to make sure no other unexpected issues pop up.
You can use this branch by adding this to your gemfile

gem 'newrelic_rpm', :git => 'https://github.com/newrelic/newrelic-ruby-agent.git',  :branch => ‘roda_require_update’

@tannalynn tannalynn reopened this Aug 17, 2023
@github-project-automation github-project-automation bot moved this from Code Complete/Done to Triage in Ruby Engineering Board Aug 17, 2023
@ColinOrr
Copy link

Hi @tannalynn, I've tested your branch locally and I can confirm that it fixes the issue. Thank you for jumping on this so quickly 🙏

I'm not sure why you're only seeing this for uppy-s3_multipart, as far as I can tell the agent's autoloader only loads the top-level /instrumentation/roda.rb module so I would expect that it would need to require the other modules from inside the roda subfolder (like it does for roda/prepend and roda/chain)... so the fix looks correct to me.

Thanks again for the prompt resolution to this issue.

@spickermann
Copy link
Author

spickermann commented Aug 18, 2023

I have tested the branch on production, and the issues are fixed. Thanks a lot.

@tannalynn
Copy link
Contributor

Thank you both for confirming this fix resolves the issue for you. I just released the fix with 9.4.2.
Please let me know if you run into any other issues!

@github-project-automation github-project-automation bot moved this from Triage to Code Complete/Done in Ruby Engineering Board Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community To tag external issues and PRs submitted by the community
Projects
Archived in project
Development

No branches or pull requests

3 participants