scoutapp / scout_apm_ruby

ScoutAPM Ruby Agent. Supports Rails, Sinatra, Grape, Rack, and many other frameworks
https://scoutapm.com
Other
197 stars 96 forks source link

JRuby Support #96

Open cschneid opened 7 years ago

cschneid commented 7 years ago

Currently, the scout_apm gem does not install on JRuby, since it references C extensions.

We have 2 C extensions in the mainline gem right now (and ScoutProf in the 3.x branch uses a C ext as well).

Both of the C extensions are related to memory usage:

Both of these are easily stubbed to return 0s, allowing the rest of the agent to work as normal. In addition, it's likely that Java contains APIs to get similar data out of the VM.

The big issue is that there doesn't seem to be any way to mark a C extension as optional for the gem. Ideally, we'd say: "do your best to build this C ext, but if not, the gem will continue to work w/ fallback code", but that doesn't seem to exist.

Other gems (like concurrent-ruby) ship an additional C ext gem (concurrent-ruby-ext). So the base gem is pure ruby, then a layered on version with C exts. This approach is a bit awkward for us, since we want our install process to be as simple and error-resistant as possible. Asking for 2 distinct gems to be installed will inevitably cause issues.

Brainstorming Approaches:

dlanderson commented 7 years ago

The Scoutprof extension has code that allows us to fall back in case we cannot compile. I think we could use the same approach here.

Geesu commented 5 years ago

Any updates on JRuby support?