open-telemetry / opentelemetry-ruby-contrib

Contrib Packages for the OpenTelemetry Ruby API and SDK implementation.
https://opentelemetry.io
Apache License 2.0
76 stars 156 forks source link

Redis Gem 5.x Support #953

Open arielvalentin opened 2 months ago

arielvalentin commented 2 months ago

The instrumentation only supports the Redis 4.x.

https://github.com/open-telemetry/opentelemetry-ruby-contrib/actions/runs/8863073727/job/24336701986?pr=951

1) Failure:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process::when db_statement is :omit#test_0001_omits db.statement attribute [test/opentelemetry/instrumentation/redis/patches/client_test.rb:300]:
  Expected: "AUTH"
    Actual: "PIPELINED"

    2) Error:
  OpenTelemetry::Instrumentation::Redis::Middlewares::RedisClientInstrumentation::#process#test_0009_records net.peer.name and net.peer.port attributes:
  NoMethodError: undefined method `name' for nil
      test/opentelemetry/instrumentation/redis_client_test.rb:163:in `block (3 levels) in <top (required)>'

    3) Failure:
  OpenTelemetry::Instrumentation::Redis::Middlewares::RedisClientInstrumentation::#process#test_0004_after authorization with Redis server [test/opentelemetry/instrumentation/redis_client_test.rb:70]:
  Expected: "AUTH ?"
    Actual: "AUTH passw0rd"

    4) Failure:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process#test_0008_records exceptions [test/opentelemetry/instrumentation/redis/patches/client_test.rb:153]:
  Expected "Unhandled exception of type: RedisClient::CommandError" to include "ERR unknown command 'THIS_IS_NOT_A_REDIS_FUNC', with args beginning with: 'THIS_IS_NOT_A_VALID_ARG".

    5) Error:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process#test_0015_truncates long db.statements:
  Redis::CommandError: ERR unknown command `queue`, with args beginning with: `set`, `v1`, `yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy`, (redis://localhost:6379)
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client/connection_mixin.rb:36:in `call'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:294:in `block (2 levels) in call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client/middlewares.rb:16:in `call'
      lib/opentelemetry/instrumentation/redis/middlewares/redis_client.rb:25:in `block in call'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace/tracer.rb:37:in `block in in_span'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace.rb:70:in `block in with_span'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/context.rb:87:in `with_value'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace.rb:70:in `with_span'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace/tracer.rb:37:in `in_span'
      lib/opentelemetry/instrumentation/redis/middlewares/redis_client.rb:24:in `call'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:293:in `block in call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:699:in `ensure_connected'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:292:in `call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis/client.rb:90:in `call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis.rb:152:in `block in send_command'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis.rb:[151](https://github.com/open-telemetry/opentelemetry-ruby-contrib/actions/runs/8862991669/job/24336536178#step:4:161):in `synchronize'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis.rb:151:in `send_command'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis/commands.rb:234:in `method_missing'
      test/opentelemetry/instrumentation/redis/patches/client_test.rb:228:in `block (3 levels) in <top (required)>'

    6) Error:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process#test_0011_traces pipelined commands on commit:
  Redis::CommandError: ERR unknown command `queue`, with args beginning with: `set`, `v1`, `0`, (redis://localhost:6379)
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client/connection_mixin.rb:36:in `call'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:294:in `block (2 levels) in call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client/middlewares.rb:16:in `call'
      lib/opentelemetry/instrumentation/redis/middlewares/redis_client.rb:25:in `block in call'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace/tracer.rb:37:in `block in in_span'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace.rb:70:in `block in with_span'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/context.rb:87:in `with_value'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace.rb:70:in `with_span'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/opentelemetry-api-1.2.5/lib/opentelemetry/trace/tracer.rb:37:in `in_span'
      lib/opentelemetry/instrumentation/redis/middlewares/redis_client.rb:24:in `call'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:293:in `block in call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:699:in `ensure_connected'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-client-0.22.1/lib/redis_client.rb:292:in `call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis/client.rb:90:in `call_v'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis.rb:[152](https://github.com/open-telemetry/opentelemetry-ruby-contrib/actions/runs/8862991669/job/24336536178#step:4:162):in `block in send_command'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis.rb:151:in `synchronize'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis.rb:151:in `send_command'
      /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/gems/3.3.0/gems/redis-5.2.0/lib/redis/commands.rb:234:in `method_missing'
      test/opentelemetry/instrumentation/redis/patches/client_test.rb:188:in `block (3 levels) in <top (required)>'

    7) Failure:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process#test_0006_reflects db index [test/opentelemetry/instrumentation/redis/patches/client_test.rb:101]:
  Expected: 3
    Actual: 2

    8) Error:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process#test_0009_records net.peer.name and net.peer.port attributes:
  NoMethodError: undefined method `name' for nil
      test/opentelemetry/instrumentation/redis/patches/client_test.rb:[163](https://github.com/open-telemetry/opentelemetry-ruby-contrib/actions/runs/8862991669/job/24336536178#step:4:173):in `block (3 levels) in <top (required)>'

    9) Failure:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process#test_0004_after authorization with Redis server [test/opentelemetry/instrumentation/redis/patches/client_test.rb:70]:
  Expected: "AUTH ?"
    Actual: "AUTH passw0rd"

   10) Failure:
  OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client::#process::when db_statement is :obfuscate#test_0001_obfuscates arguments in db.statement [test/opentelemetry/instrumentation/redis/patches/client_test.rb:329]:
  Expected: "AUTH"
    Actual: "PIPELINED"

  50 runs, 178 assertions, 6 failures, 4 errors, 0 skips
  rake aborted!
  Command failed with status (1)
  /opt/hostedtoolcache/Ruby/3.3.0/x64/bin/bundle:25:in `load'
  /opt/hostedtoolcache/Ruby/3.3.0/x64/bin/bundle:25:in `<main>'
  Tasks: TOP => test
  (See full trace by running task with --trace)
kaylareopelle commented 2 months ago

Next step: Release a bounded version of the gem to not install the instrumentation on Redis 5 as a bugfix bump After: Add support for Redis 5

kaylareopelle commented 2 months ago

Here's the main PR that introduced Redis 5.x support in the New Relic Ruby agent: https://github.com/newrelic/newrelic-ruby-agent/pull/1611

kaylareopelle commented 2 months ago

It looks like some work has already taken place to support Redis 5: https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/121

I don't think the OpenTelemetry::Instrumentation::Redis::Patches::RedisV4Client tests should be running on a Redis 5.x appraisal. However, the two failures from OpenTelemetry::Instrumentation::Redis::Middlewares::RedisClientInstrumentation should be passing.

github-actions[bot] commented 1 month ago

👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.