instana / ruby-sensor

💎 Ruby Distributed Tracing & Metrics Sensor for Instana
https://www.instana.com/
MIT License
26 stars 25 forks source link

Add Rails 6 ActionView compatibility #177

Closed vlad-pisanov closed 4 years ago

vlad-pisanov commented 4 years ago

This should be an easy fix.

https://github.com/instana/ruby-sensor/blob/master/lib/instana/frameworks/instrumentation/action_view.rb#L9

Currently, the gem hijacks :render_partial and :render_collection in ::ActionView::PartialRenderer. Prior to Rails 6, these methods didn't take parameters, but as of Rails 6, the signature of those methods has changed to accept two parameters: https://github.com/rails/rails/blob/6-0-stable/actionview/lib/action_view/renderer/partial_renderer.rb#L322

Since the wrappers render_partial_with_instana and render_collection_with_instana don't accept any parameters, this crashes views with partials in Rails 6.

Proposed Fix

To accommodate old and new versions of Rails, redefine the wrapper to:

def render_partial_with_instana(*args)
  ...
  render_partial_without_instana(*args)
  ...
end

(same with render_collection_with_instana)

pglombardo commented 4 years ago

Thanks for the pointer @vlad-pisanov! I'll see if I can make these changes this week and put out a new release.

pglombardo commented 4 years ago

This has been fixed and released in gem 1.11.4. Thanks for filing @vlad-pisanov!