instana / ruby-sensor

💎 Ruby Distributed Tracing & Metrics Sensor for Instana
https://www.instana.com/
MIT License
26 stars 25 forks source link

[Bug]: Ruby support for < 2.4 is broken #283

Closed rafaeldriutti closed 1 year ago

rafaeldriutti commented 1 year ago

Problem Description

The rspec file for this project claims it works with Ruby < 2.4 but the code in https://github.com/instana/ruby-sensor/blob/f6fb1b12953d01054da54eb66250fc8fd35f0dc5/lib/instana/backend/host_agent_activation_observer.rb#L68

Uses the hash.compact method which was introduced in Ruby 2.4

Not sure at this point if it's worth mantaining compatibility with such old releases or just update https://github.com/instana/ruby-sensor/blob/master/instana.gemspec#L34 to prevent bundler to download uncompatible versions of the gem. I ended up updating the ruby version for the project I'm working so I don't really need this fixed. Reporting nonetheless in case someone else stumbles into this.

Minimal, Complete, Verifiable, Example

Try to load the gem on with ruby 2.1 or 2.2 app with INSTANA_DEBUG=True on the env. You will see the stacktraces for the missing method error when the gem loads.

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (4.2.5)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    aws-sdk (2.2.15)
      aws-sdk-resources (= 2.2.15)
    aws-sdk-core (2.2.15)
      jmespath (~> 1.0)
    aws-sdk-resources (2.2.15)
      aws-sdk-core (= 2.2.15)
    bugsnag (2.7.1)
      multi_json (~> 1.0)
    byebug (8.2.1)
    coderay (1.1.0)
    concurrent-ruby (1.1.10)
    diff-lcs (1.2.5)
    dotenv (2.1.0)
    ffi (1.9.10)
    formatador (0.2.5)
    guard (2.13.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, <= 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-rspec (4.6.4)
      guard (~> 2.1)
      guard-compat (~> 1.1)
      rspec (>= 2.99.0, < 4.0)
    i18n (0.7.0)
    instana (1.209.2)
      concurrent-ruby (>= 1.1)
      oj (>= 3.0.11)
      sys-proctable (>= 1.2.2)
    jaeger-client (0.10.0)
      opentracing (~> 0.3)
      thrift
    jmespath (1.1.3)
    json (1.8.3)
    listen (3.0.5)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    lumberjack (1.0.10)
    method_source (0.8.2)
    mini_portile2 (2.0.0)
    minitest (5.8.3)
    multi_json (1.11.2)
    nenv (0.2.0)
    nokogiri (1.6.7.2)
      mini_portile2 (~> 2.0.0.rc2)
    nori (2.6.0)
    notiffany (0.0.8)
      nenv (~> 0.1)
      shellany (~> 0.0)
    oj (3.10.8)
    opentracing (0.5.0)
    pidfile (0.3.0)
    pry (0.10.3)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-byebug (3.3.0)
      byebug (~> 8.0)
      pry (~> 0.10)
    pry-doc (0.8.0)
      pry (~> 0.9)
      yard (~> 0.8)
    rake (10.5.0)
    rb-fsevent (0.9.7)
    rb-inotify (0.9.5)
      ffi (>= 0.5.0)
    rspec (3.4.0)
      rspec-core (~> 3.4.0)
      rspec-expectations (~> 3.4.0)
      rspec-mocks (~> 3.4.0)
    rspec-core (3.4.1)
      rspec-support (~> 3.4.0)
    rspec-expectations (3.4.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-mocks (3.4.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-support (3.4.1)
    rubywmq (2.1.0)
    shellany (0.0.1)
    slop (3.6.0)
    statsd-ruby (1.4.0)
    sys-proctable (1.2.6)
      ffi
    thor (0.19.1)
    thread_safe (0.3.5)
    thrift (0.11.0.0)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    values (1.8.0)
    yard (0.8.7.6)

PLATFORMS
  ruby

DEPENDENCIES
  activesupport
  aws-sdk (~> 2)
  bugsnag
  byebug
  dotenv
  guard
  guard-rspec
  instana
  jaeger-client
  json
  nokogiri
  nori
  opentracing
  pidfile
  pry
  pry-byebug
  pry-doc
  rake
  rspec
  rubywmq
  statsd-ruby
  values

BUNDLED WITH
   1.17.3

Ruby Version

2.2