opentelemetry-ruby-contrib
opentelemetry-ruby-contrib copied to clipboard
Latest release of active_record instrumentation fails to install on a rails 7 app
Description of the bug
After installing the latest release of opentelemetry-ruby (v0.2.2) via opentelemetry-instrumentation-all and configuring it using use_all, I see the following message in the logs when starting up my app:
WARN -- : Instrumentation: OpenTelemetry::Instrumentation::ActiveRecord failed to install
After doing some digging I found this PR which appears to fix the issue: https://github.com/open-telemetry/opentelemetry-ruby/pull/1043
However, when I inspect the source that was installed the changes from that PR are not present. It looks like maybe a release with those changes failed, or I'm just misunderstanding the release cadence for this lib.
I am able to work around this with the following monkey-patch placed before my instrumentation setup:
module OpenTelemetry
module Instrumentation
module ActiveRecord
class Instrumentation < OpenTelemetry::Instrumentation::Base
compatible do
true
end
end
end
end
end
That silences the warning, but I'm a bit concerned about running on this version w/out the additional changes included in that PR.
Share details about your runtime
Operating system details: Linux, Ubuntu 20.04 LTS RUBY_ENGINE: "ruby" RUBY_VERSION: "3.1.0" RUBY_DESCRIPTION: "ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin20]"
Share a simplified reproduction if possible
# In Gemfile
gem 'opentelemetry-sdk'
gem 'opentelemetry-exporter-oltp'
gem 'opentelemetry-instrumentation-all'
# config/initializers/opentelemetry.rb
OpenTelemetry::SDK.configure do |c|
c.use_all()
end
I could be wrong but looks like the fix has not yet been released.
Also may I confirm that you are using v1.0.2 of the SDK?
Yea, it looks to me like the release that was meant to include it was here: https://github.com/open-telemetry/opentelemetry-ruby/pull/1082#issuecomment-1009256714
Confirmed using v1.0.2 of SDK as well.
@supaspoida unfortunately that comment indicates that the ActiveRecord instrumentation had change but would not be included in the release since it was a targeted release of the Trilogy instrumentation.
I will put in a request to release AR Instrumentation now.
@arielvalentin just did a scan of recent releases and it seems active_record hasn't had one cut with this fix yet. Anything we can do to help that along?
Thank you!
@supaspoida Did this release not include it?
https://github.com/open-telemetry/opentelemetry-ruby/releases/tag/opentelemetry-instrumentation-active_record%2Fv0.3.0
@supaspoida following up. I am going to assume that this is working for newer versions of the gem. Please reopen if you still need help.