Using JRuby with trinidad (developer mode) – I was intermittently getting this error. Apparently thrown as estimated_time for the transaction was returning nil. I was also having all sorts of other issues (undefined method `metric_name’ for nil:NilClass) with all newrelics action summaries.
To resolve (following suggestions on the trinidad google group):
|
1 2 3 4 5 6 7 8 9 10 |
# config/initializers/newrelic.rb
if defined?(JRUBY_VERSION) && Rails.env == "development"
require 'newrelic_rpm'
NewRelic::Agent.manual_start({:dispatcher => :trinidad, :agent_enabled => true})
end
# Gemfile
group :development do
gem 'newrelic_rpm', '3.3.0', :require => false
end |
According to Nick Sieger’s gist – “NewRelic isn’t detecting Trinidad at the moment” – Although I could see trinidad’s detection mechanism implemented in newrelic’s most recent (3.5.0.1)
I’ve tried it with more recent versions of newrelic – but it seems 3.3.0 is the most stable.
JRuby 1.6.8 (1.9 mode)
trinidad 1.4.4
newrelic_rpm 3.3.0
Getting another error of undefined method `first' for true:TrueClass. The error is apparently thrown if the “EXPLAIN” query has failed against the DB engine. Although – I got the transaction_tracing disabled with explain_enabled set to false – yet this release still attempts to fire the “EXPLAIN” against the DB.
Since I’m using the oracle_enhanced_adapter, the current newrelic “EXPLAIN” query wouldn’t work – hence an error is thrown. However, the error consumption by newrelic returns true rather than nil.
Changing handle_exception_in_explain to return nil instead of the true fixes it.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
def handle_exception_in_explain
yield
rescue Exception => e
begin
# guarantees no throw from explain_sql
NewRelic::Control.instance.log.error("Error getting query plan: #{e.message}")
NewRelic::Control.instance.log.debug(e.backtrace.join("\n"))
# UPDATE: Added to prevent issues when drilling down deep into SQL (explain not working)
nil
rescue Exception
# double exception. throw up your hands
end
end |
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.