basecamp / marginalia

Attach comments to ActiveRecord's SQL queries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

only ever get "block in execute"

philsmy opened this issue · comments

The only thing I am getting in my slow query log is this:

line:(eval):31:in `block in execute'

and often I get no commenting at all.

My marginalia.rb looks like this:

Marginalia.application_name = "OurApp"

Marginalia::Comment.components = [:application, :controller, :line, :job]

The comment is the same, regardless if it is coming from a controller action, a delayed job, or the console! Even the line number is always the same.

Maybe I am misunderstanding something?

[edit: using Rails 4.2.9 with ruby 2.1.10]

Further to this, I added a line in production to print out every line in the "caller.detect" method.

      def self.line
        Marginalia::Comment.lines_to_ignore ||= /\.rvm|gem|vendor\/|marginalia|rbenv/
        last_line = caller.detect do |line|
          Rails.logger.info line
          line !~ Marginalia::Comment.lines_to_ignore
        end

This is what I got when calling one of my controller actions from a browser:

/mnt/app-production/shared/bundle/ruby/2.2.0/gems/marginalia-1.5.0/lib/marginalia/comment.rb:23:in `block in construct_comment'
/mnt/app-production/shared/bundle/ruby/2.2.0/gems/marginalia-1.5.0/lib/marginalia/comment.rb:22:in `each'
/mnt/app-production/shared/bundle/ruby/2.2.0/gems/marginalia-1.5.0/lib/marginalia/comment.rb:22:in `construct_comment'
/mnt/app-production/shared/bundle/ruby/2.2.0/gems/marginalia-1.5.0/lib/marginalia.rb:49:in `annotate_sql'
/mnt/app-production/shared/bundle/ruby/2.2.0/gems/marginalia-1.5.0/lib/marginalia.rb:58:in `execute_with_marginalia'
(eval):31:in `block in execute'

So I'm not surprised there's nothing useful in the comments as I don't see anything useful here!

I'm going to close this issue, presuming it's stale.

But it sounds like one of your controllers is doing an eval which results in a query. Perhaps look for eval in your controllers? Or carefully step through a controller triggering this issue looking for where an eval might occur?