librato / librato-metrics

Ruby wrapper to make it easy to interact with Librato's API.
https://librato.com
Other
108 stars 51 forks source link

Relax faraday version range constraint to allow newer Rubies #143

Closed jasonrudolph closed 4 years ago

jasonrudolph commented 4 years ago

Closes https://github.com/librato/librato-metrics/issues/142.


This pull request relaxes the faraday version constraint so that consumers of this gem can use newer versions of faraday that support Ruby 2.7.

Please note that this pull request targets the librato-metrics 1.x branch, as some Librato customers cannot upgrade to 2.x.

Because faraday 1.0 introduces a breaking change regarding the namespacing of its error classes, this pull request updates the Faraday::Error::ConnectionFailed reference to use Faraday::ConnectionFailed instead. This change is backwards compatible with older versions of faraday. Without that change, you see the following failure when running the test suite with faraday 1.0.0:

$ bundle exec rake
bin/ruby -S bundle exec rspec --color spec/unit/metrics/aggregator_spec.rb spec/unit/metrics/client_spec.rb spec/unit/metrics/connection_spec.rb spec/unit/metrics/queue/autosubmission_spec.rb spec/unit/metrics/queue_spec.rb spec/unit/metrics_spec.rb
........................................F.....................................................

Failures:

  1) Librato::Metrics::Connection network operations with 400 class errors should not retry
     Failure/Error: lambda {
       expected Librato::Metrics::NotFound, got #<NameError: uninitialized constant Faraday::Error::ConnectionFailed
       Did you mean?  Faraday::ConnectionFailed>
     # ./spec/unit/metrics/connection_spec.rb:70:in `block (5 levels) in <module:Metrics>'
     # ./spec/unit/metrics/connection_spec.rb:69:in `block (4 levels) in <module:Metrics>'

Finished in 4.03 seconds
94 examples, 1 failure

Failed examples:

rspec ./spec/unit/metrics/connection_spec.rb:67 # Librato::Metrics::Connection network operations with 400 class errors should not retry
rake aborted!
ruby -S bundle exec rspec --color spec/unit/metrics/aggregator_spec.rb spec/unit/metrics/client_spec.rb spec/unit/metrics/connection_spec.rb spec/unit/metrics/queue/autosubmission_spec.rb spec/unit/metrics/queue_spec.rb spec/unit/metrics_spec.rb failed
/private/tmp/librato-metrics/Rakefile:28:in `block in <top (required)>'
bin/bundle:23:in `load'
bin/bundle:23:in `<main>'
Command failed with status (1): [bin/ruby -S...]
/private/tmp/librato-metrics/Rakefile:28:in `block in <top (required)>'
bin/bundle:23:in `load'
bin/bundle:23:in `<main>'
Tasks: TOP => default => spec
(See full trace by running task with --trace)
akahn commented 4 years ago

Can you and @magni- and @irphilli try this out in production applications and report back on how it goes for you?

magni- commented 4 years ago

@akahn We've been using a fork of the 1.x branch with the relaxed constraint (with faraday v0.17.3) on our main app at @rainforestapp for three months now, no issues.