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

Is it possible to use this gem with Newrelic? #5

Closed
abezzub opened this issue Jun 6, 2017 · 4 comments
Closed

Is it possible to use this gem with Newrelic? #5

abezzub opened this issue Jun 6, 2017 · 4 comments

Comments

@abezzub
Copy link

abezzub commented Jun 6, 2017

When I try to set this up on an app that also uses Newrelic it produces stack overflow error:

Unable to load application: SystemStackError: stack level too deep
/app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:20:in `>=': stack level too deep (SystemStackError)
from /app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:20:in `rack_version_supported?'
from /app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:12:in `version_supported?'
from /app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:32:in `middleware_instrumentation_enabled?'
from /app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:94:in `use_with_newrelic'
from /app/vendor/bundle/ruby/2.4.0/gems/rack-freeze-1.2.0/lib/rack/freeze/builder.rb:28:in `use'
from /app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:96:in `use_with_newrelic'
from /app/vendor/bundle/ruby/2.4.0/gems/rack-freeze-1.2.0/lib/rack/freeze/builder.rb:28:in `use'
from /app/vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/rack.rb:96:in `use_with_newrelic'
 ... 9702 levels...
from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.9.0/lib/puma/cli.rb:77:in `run'
from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.9.0/bin/puma:10:in `<top (required)>'
from /app/vendor/bundle/ruby/2.4.0/bin/puma:22:in `load'
from /app/vendor/bundle/ruby/2.4.0/bin/puma:22:in `<main>'

From what I understand newrelic also wraps all middleware classes in its own class, which conflicts with rack-freeze:
https://github.com/newrelic/rpm/blob/master/lib/new_relic/agent/instrumentation/rack.rb#L142

@ioquatix
Copy link
Owner

It should be, but I'll need to investigate exactly what is going on here.

@ioquatix
Copy link
Owner

We've got this working, and not had the same issues - if you change the order of loading new relic and rack/freeze - do you get any changes?

@abezzub
Copy link
Author

abezzub commented Jun 22, 2017

Thanks, requiring newrelic before rack-freeze solved the issue.

@abezzub abezzub closed this as completed Jun 22, 2017
@ioquatix
Copy link
Owner

Awesome! I was actually surprised to see how deep new relic messes with things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants