aws / aws-xray-sdk-ruby

The official AWS X-Ray Recorder SDK for Ruby
Apache License 2.0
60 stars 58 forks source link

Add method to get database configuration. #55

Closed miyucy closed 3 years ago

miyucy commented 3 years ago

In Rails v6.1.0, ActiveRecord::ConnectionAdapters::ConnectionPool class does not have spec method.

Issue #, if available:

Description of changes:

After upgrade to rails v6.1 at our product. aws-xray-sdk raise error.

like:

> Post.first
NoMethodError: undefined method `spec' for #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x00007fac1c415670>

/app/vendor/bundle/ruby/2.7.0/gems/aws-xray-sdk-0.11.5/lib/aws-xray-sdk/facets/rails/active_record.rb:20:in `record'
/app/vendor/bundle/ruby/2.7.0/gems/aws-xray-sdk-0.11.5/lib/aws-xray-sdk/facets/rails/active_record.rb:81:in `block in <main>'
/app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb:186:in `finish'
/app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb:63:in `block in finish'
/app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb:63:in `each'
/app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb:63:in `finish'
/app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.0/lib/active_support/notifications/instrumenter.rb:45:in `finish_with_state'
/app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.0/lib/active_support/notifications/instrumenter.rb:30:in `instrument'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:688:in `log'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:691:in `exec_cache'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:657:in `execute_and_clear'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:53:in `exec_query'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:536:in `select_prepared'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:67:in `select_all'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:103:in `select_all'
/app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.0/lib/active_record/querying.rb:47:in `find_by_sql'

I think it causes ConnectionPool class was change in rails v6.1.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

johan-smits commented 3 years ago

This is solved in #57

Guess yours got missed @anuraaga