-
Notifications
You must be signed in to change notification settings - Fork 182
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
fix: do not expose auth params with Redis 5 #1370
base: main
Are you sure you want to change the base?
Conversation
@@ -297,7 +338,7 @@ def redis_with_auth(redis_options = {}) | |||
_(exporter.finished_spans.size).must_equal 3 | |||
|
|||
set_span = exporter.finished_spans[0] | |||
_(set_span.name).must_equal 'AUTH' | |||
_(set_span.name).must_equal(redis_gte_5? ? 'PIPELINED' : 'AUTH') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to look into splitting these tests up. I know it will lead to duplication but conditional logic in tests that go beyond using skip
become difficult to reason about IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to individually duplicate the tests that should be forked, or duplicate the file entirely for v5?
redis_options[:host] = redis_host | ||
redis_options[:port] = redis_port | ||
RedisClient.new(**redis_options) | ||
redis_options[:password] ||= password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these lazily initialized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seemed appropriate not to clobber the options from the argument if they are given — the redis_with_auth(host: 'example.com' ...
test fails without this.
|
||
skip('FIXME: what is this intended to test?') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this skip
during my last review.
I think what the intent was was to ensure the span had the net.peer.*
attributes where captured during a network failure to execute the auth
command.
Are there changes in how the driver works that would make this impossible to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, forgot to follow up on that one. RedisClient tries to do the connect before any of the middlewares are invoked, so we don't get a span here under that implementation. I don't think it's within the scope of the PR to change that behavior (previously, the test was erroneously running the RedisV4 client instrumentation), but I didn't want to complete clobber the expectations (these still exist in the other test file). I can clarify the comment so that if that span is ever added for RedisClient, it should have those attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case then I think it's fine to delete the test since we won't be able to get a span generated from it.
Additionally: - Add a redis 5 appraisal - use RedisClient in RedisClient tests
@arielvalentin thanks for your feedback; I clarified some of the test changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this, @zvkemp!
it may be more clear to group the tests based on their API rather than which patch/middleware applies.
I like this idea. I don't think refactoring the tests needs to be accomplished in this PR. What do you think about opening an issue to save this work for a future date?
Redis 5 is a wrapper around RedisClient, so the middleware-based instrumentation (intended for RedisClient) applies here.
redis_gte_5?
helper method.queue
method invocations (deprecated in v4, removed in v5) have been replaced withpipelined
Redis.new
does not use RedisClient internally).