Closed simpl1g closed 7 months ago
Patched method that has keyword arguments can raise error
require 'bundler/inline' gemfile do gem 'prometheus_exporter', '2.1.0' end require 'prometheus_exporter/instrumentation/method_profiler' class Test def method(sql, cache: false, **settings) puts "sql -> #{sql}" puts "cache -> #{cache}" puts "settings -> #{settings}" end end PrometheusExporter::Instrumentation::MethodProfiler.patch(Test, [:method], :some_name, instrument: :prepend) t = Test.new t.method('select * from table') # sql -> select * from table # cache -> false # settings -> {} t.method('select * from table', cache: true, other_setting: false) # => wrong number of arguments (given 2, expected 1) (ArgumentError)
@SamSaffron I can create pull request that:
...
def #{method_name}(...)
Are you ok with these changes?
Patched method that has keyword arguments can raise error
@SamSaffron I can create pull request that:
...
, it was introduced in 2.7 => https://ryanbigg.com/2021/07/ruby-27s-new-triple-dot-syntaxdef #{method_name}(...)
Are you ok with these changes?