prometheus / client_ruby

Prometheus instrumentation library for Ruby applications
Apache License 2.0
513 stars 149 forks source link

undefined method `unpack1' for String (NoMethodError) when use in ruby < 2.4 #315

Closed xeruzo closed 3 months ago

xeruzo commented 3 months ago

i have a project use ruby 2.3.0, and is ok runing with prometheus before 4.2.3

but in the new version 4.2.3
i find it has new dependency the gem base64 >= 0
and the base64 is use unpack1 method

see this: https://github.com/ruby/base64/blob/v0.1.0/lib/base64.rb

and is now throw a error , can u think to remove dependency the gem base64 in next version or add only limit ruby >= 2.4 can use newest version?

ruby: 2.3.0p0 rails: 5.0.3

gemfile
....
gem 'puma-metrics', '1.2.0' ...

/usr/local/bundle/gems/base64-0.1.1/lib/base64.rb:59:in `decode64': undefined method `unpack1' for "**************":String (NoMethodError)
Sinjo commented 3 months ago

Hey, thanks for reporting this.

I'm afraid Ruby 2.3 dropped off our compatibility list a while ago as it's EOL.

I'm not going to preach to you about upgrading the version of Ruby you use, but versions of this gem have only been working for you by chance since we dropped 2.3 support back in 2020.

xeruzo commented 3 months ago

thx to answer my isse.

use 4.2.2 also can fix my problem