Hi everyone,
Our JRuby is in production now 馃帀 馃檪
We use JRuby 9.2.7.0 (latest), Rails 4.2.11.1, activerecord-jdbcmysql-adapter 1.3.25 and ddtrace 0.22.0.
And at the app boot, we see the following message:
[2019-04-26T11:14:49.088304 #32] WARN -- ddtrace: [ddtrace] Unable to patch Datadog::Contrib::Mysql2::Integration
While it seems that our DB queries are correctly monitored.
I don't know what's the problem behind this message but I wanted to report it.
Jules
Thanks for the report! Glad JRuby is working for you in prod :)
That warning is produced if use :mysql2 is activated and the mysql2 gem is not present. You might still be seeing traces for the DB layer if you also activated ActiveRecord or Rails which contains ActiveRecord.
Hey all, not a maintainer here but I had added this little warn log the other day so figured I'd take a look, ty for surfacing this @guizmaii much appreciated. @delner i had taken a look it actually might be a bug? Let me know what you think
So that warn line is basically just getting logged if !self.class.compatible?, however, looks like Datadog::Contrib::Mysql2::Integration doesn't implement the compatible? method and so we fall back to the Contrib::Integration compatible? method, which checks RUBY_VERSION >= '1.9.3'
This probably should get adjusted to alternatively also check for something along the lines of
(RUBY_VERSION >= '1.9.3' || (defined?(JRUBY_VERSION) && JRUBY_VERSION >= '9.1.5')) && present?
What do you think? Had only taken a quick look here
Ah okay, mysql2 should define a compatible? check, if it has requirements that are different than what we already have defined. Otherwise, yeah, maybe not a bad idea to add JRuby to the Integration level compatible? check for now.
But I do wonder, if that's the resolution, shouldn't all integrations currently fire this warning when you're running JRuby? I would've expected this to be a bit more widespread.
Looking at the /contrib directory it looks like most (not all) of the integrations have a defined self.compatible? method, so I think this warning would only occur for folks running JRuby and using one of half dozen or so integrations without a defined self.compatible? method
COMP10929:contrib eric.mustin$ grep -L "def self.compatible?" */integration.rb
aws/integration.rb
concurrent_ruby/integration.rb
delayed_job/integration.rb
excon/integration.rb
http/integration.rb
mysql2/integration.rb
rack/integration.rb
resque/integration.rb
shoryuken/integration.rb
Hmmm okay. Perhaps we should just add the JRuby check to the Integration level compatible? check.
@delner sounds good to me, i've made a quick PR for this, https://github.com/DataDog/dd-trace-rb/pull/744 , although I guess am a bit confused since I too think this issue ought to have been more widely reported since it still touched a good number of integrations. I guess it can't hurt to add regardless but anyway let me know what you think.
Hey @guizmaii, I noticed today, when we merged our official JRuby 9.2 support that this ActiveRecord JDBC issue was open.
mysql2 will not successfully install under JRuby, as its native components have not been ported to support it. Thankfully, like you mentioned, JDBC is available as a database driver which works just as well.
The additional compatibility checks mentioned in the comments above have actually been added to ddtrace for a while. We will actually short-circuit the version check, as the gem is not even installed under JRuby, so we'll properly report it as not patchable.
We documented that mysql2 (alongside grpc) are not supported by JRuby, and thus not supported by ddtrace under JRuby.
I'll close this issue when the next release goes out, containing full JRuby support.
@marcotc Great work! Thanks 馃檪
I don't work anymore in the Ruby world but it's good to see that you're now officially supporting JRuby. 馃憤
With the release of 0.39.0, we have full support for JRuby 9.2.
I'll close this issue as ActiveRecord+JRuby support should be working as expected now.
Feel free to let us know if any further issues arise.
Most helpful comment
With the release of 0.39.0, we have full support for JRuby 9.2.
I'll close this issue as ActiveRecord+JRuby support should be working as expected now.
Feel free to let us know if any further issues arise.