Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Redis instrumentation crashes when using client.call([:command, args]) #796

Closed
brafales opened this issue Aug 21, 2019 · 3 comments
Closed
Assignees
Labels
bug Involves a bug community Was opened by a community member integrations Involves tracing integrations
Milestone

Comments

@brafales
Copy link

Hi,

We've encountered an issue when upgrading to version 0.25.1 of the gem. We have code in our application that uses the redis-rb Redis class call method by calling it the following way:

Redis.call([:del, "key1", "key2", "key3"])

As per the docs: https://www.rubydoc.info/github/redis/redis-rb/Redis#call-instance_method.

As far as we know this is a valid way to interact with Redis, but raises an error in the following line: https://github.com/DataDog/dd-trace-rb/blob/master/lib/ddtrace/contrib/redis/quantize.rb#L30 since command_args.first evaluates to an Array and therefore calling to_sym on an Array raises an error.

Here's a stack trace I can provide:

vendor/bundle/ruby/2.6.0/gems/ddtrace-0.26.0/lib/ddtrace/contrib/redis/quantize.rb:30:in `auth_command?': undefined method `to_sym' for #<Array:0x00007f573a3671b0>
Did you mean?  to_s
               to_set (NoMethodError)
    from vendor/bundle/ruby/2.6.0/gems/ddtrace-0.26.0/lib/ddtrace/contrib/redis/quantize.rb:23:in `format_command_args'
    from vendor/bundle/ruby/2.6.0/gems/ddtrace-0.26.0/lib/ddtrace/contrib/redis/patcher.rb:67:in `block in call'
    from vendor/bundle/ruby/2.6.0/gems/ddtrace-0.26.0/lib/ddtrace/tracer.rb:303:in `trace'
    from vendor/bundle/ruby/2.6.0/gems/ddtrace-0.26.0/lib/ddtrace/contrib/redis/patcher.rb:64:in `call'
    from vendor/bundle/ruby/2.6.0/gems/redis-4.1.2/lib/redis.rb:88:in `block in call'
    from vendor/bundle/ruby/2.6.0/gems/redis-4.1.2/lib/redis.rb:52:in `block in synchronize'
    from /usr/local/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
    from vendor/bundle/ruby/2.6.0/gems/redis-4.1.2/lib/redis.rb:52:in `synchronize'
    from vendor/bundle/ruby/2.6.0/gems/redis-4.1.2/lib/redis.rb:87:in `call'

We have since changed our code to use REDIS.del("key1", "key2") instead but we think given the other command is expected to be valid, the gem should be prepared to process it.

To reproduce:
In any ddtrace enabled ruby project using redis instrumentation, open a ruby console and type: Redis.call([:del, "key1", "key2", "key3"]) where Redis is a Redis client using the redis-rb gem.

Expected result:

  • ddtracer should report metrics of a DEL command in Redis

Actual result:
Error is raised.

@delner delner self-assigned this Sep 4, 2019
@delner delner added bug Involves a bug community Was opened by a community member labels Sep 4, 2019
@delner
Copy link
Contributor

delner commented Sep 4, 2019

Hey @brafales, sorry for the late response, but thank you for the thorough report! We will try to reproduce this on our end; the details you provided should make that pretty simple.

@dustMason
Copy link

dustMason commented Sep 6, 2019

We also just bumped into this bug while trying to upgrade.

@delner delner added the integrations Involves tracing integrations label Sep 6, 2019
@marcotc marcotc added this to the 0.28.0 milestone Sep 18, 2019
@marcotc
Copy link
Member

marcotc commented Oct 1, 2019

Hey @brafales @dustMason, we've just released version 0.28.0 with a fix to this issue.

I'm going to close this issue for now, let us know if the problem persists.

@marcotc marcotc closed this as completed Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug community Was opened by a community member integrations Involves tracing integrations
Projects
None yet
Development

No branches or pull requests

4 participants