ankane / pghero

A performance dashboard for Postgres
MIT License
8.16k stars 452 forks source link

ArgumentError in `slow_queries` #489

Closed rcovar00 closed 8 months ago

rcovar00 commented 8 months ago

When attempting to use the PgHero.slow_queries method in an environment with Ruby 3.0.6, an ArgumentError occurs.

Steps to Reproduce:

  1. Upgrade to Ruby 3.0.6
  2. Run PgHero.slow_queries.
  3. Observe the mentioned ArgumentError.

Environment Information:

Error Message and Stack Trace:

ArgumentError:  wrong number of arguments (given 1, expected 0)
/gems/pghero-3.4.0/lib/pghero/methods/query_stats.rb:4 in query_stats
/gems/pghero-3.4.0/lib/pghero/methods/query_stats.rb:171 in slow_queries
vendor/ruby-3.0.6/lib/ruby/3.0.0/forwardable.rb:238 in slow_queries
236:    end;
237:  end
238:end
239:
240:# SingleForwardable can be used to setup delegation at the object level as well.

lib/tasks/pg_hero.rake:22 in diagnose_queries
20: def diagnose_queries
21: # Check for slow queries
22: slow_queries_to_notify = PgHero.slow_queries
ankane commented 8 months ago

Hi @rcovar00, thanks for reporting! Fixed in the commit above.