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

Allow ability to disable Redis capturing the args #1276

Merged
merged 10 commits into from
Dec 9, 2020

Conversation

callumj
Copy link
Contributor

@callumj callumj commented Dec 5, 2020

For security (& memory allocation reasons) we want to disable this as the keys could contain sensitive information. Allow for this to be disabled.

For security (& memory allocation reasons) we want to disable this as the keys could contain sensitive information. Allow for this to be disabled.
@callumj callumj requested a review from a team December 5, 2020 00:51
Copy link
Contributor

@ericmustin ericmustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@callumj Thanks for the contrib. A few nits and things I wanted to point out but generally this is something I'm on board with.

  • I think our tracing ingest pipeline already has some hooks in place for the security aspect of this, https://docs.datadoghq.com/tracing/setup_overview/configure_data_security/?tab=redis#agent-trace-obfuscation where you can obfuscate redis.raw_command as well as the resource. Completely fine with addressing things at the tracing client level since it also has memory perf improvements, but more out of curiosity, have y'all tried that agent-based approach and found it lacking? Or just simply prefer to address things at the app level? If there were any issues with the agent approach, certainly that feedback is valuable, and I'd be happy to work with the folks maintaining the datadog-agent to try to improve things there.

  • With the implementation as is, we're not setting any resource, which is a bit problematic. I think at the datadog-agent level there's some normalization code that kicks in and assigns the span.name to be the resource if the resource is nil, but it's probably better to at least do that at the tracer level. If there's a happy path to setting just the operation get / set / etc etc i think that would be even better, but i'd like your opinion on this, i left a longer comment in the review.

Overall, great work, thanks for the contribution!

lib/ddtrace/contrib/redis/patcher.rb Outdated Show resolved Hide resolved
@callumj
Copy link
Contributor Author

callumj commented Dec 7, 2020

I think our tracing ingest pipeline already has some hooks in place for the security aspect of this, https://docs.datadoghq.com/tracing/setup_overview/configure_data_security/?tab=redis#agent-trace-obfuscation where you can obfuscate redis.raw_command as well as the resource. Completely fine with addressing things at the tracing client level since it also has memory perf improvements, but more out of curiosity, have y'all tried that agent-based approach and found it lacking? Or just simply prefer to address things at the app level? If there were any issues with the agent approach, certainly that feedback is valuable, and I'd be happy to work with the folks maintaining the datadog-agent to try to improve things there.

Good call out - normally I would use the span filter as that is very powerful but in this area I figured it would be best to offer this as an option because you then avoid some allocations if you are using Redis really heavily and might be on an older interpreter. I would prefer controlling things at the app level because if we had a shared agent (like a sidecar) it would avoid config changes and instead just require simpler app level changes.

marcotc
marcotc previously approved these changes Dec 7, 2020
Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work, @callumj! I added a few comments, but looks pretty good overall.

@ericmustin's feedback (which I see you have already read) has the main points we'd like to addressed to get it merged.

docs/GettingStarted.md Outdated Show resolved Hide resolved
lib/ddtrace/contrib/redis/patcher.rb Outdated Show resolved Hide resolved
Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@callumj thank you for addressing our feedback, and quickly! The changes look good.

I left one comment about the PIPELINE implementation, please take a look and let me know if it makes sense.

lib/ddtrace/contrib/redis/patcher.rb Outdated Show resolved Hide resolved
callumj and others added 2 commits December 8, 2020 14:05
Co-authored-by: Marco Costa <mmarcottulio@gmail.com>
@@ -59,10 +59,10 @@ def call_pipeline(*args, &block)
pin.tracer.trace(Datadog::Contrib::Redis::Ext::SPAN_COMMAND) do |span|
span.service = pin.service
span.span_type = Datadog::Contrib::Redis::Ext::TYPE
commands = args[0].commands.map { |c| Datadog::Contrib::Redis::Quantize.format_command_args(c) }
commands = get_pipeline_commands(args)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcotc Assignment Branch Condition size has been violated because of this change: do you normally extract these out or ignore the cop?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your call, to be honest. I'm ok with either approach.

I noticed you extracted it, which actually looks much nicer!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @marcotc the issue is in patch_redis_client (which does the class_eval).

Copy link
Member

@marcotc marcotc Dec 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and add an "Assignment Branch Condition" exception here, no worries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thank you @marcotc

Copy link
Contributor

@ericmustin ericmustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you for the contribution(s), @callumj . will wait for @marcotc to approve as well before merging, as he also had some feedback, although it looks like it's been addressed.

Thanks again!

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your responsive updates, @callumj! 🚀 :shipit:

@marcotc marcotc added community Was opened by a community member integrations Involves tracing integrations labels Dec 9, 2020
@marcotc marcotc merged commit a6b4845 into DataDog:master Dec 9, 2020
@marcotc marcotc added this to the 0.44.0 milestone Dec 9, 2020
@callumj
Copy link
Contributor Author

callumj commented Dec 11, 2020

Thank you @marcotc, do you know when 0.44.0 will be released?

@marcotc
Copy link
Member

marcotc commented Dec 11, 2020

@callumj we have one cross-team effort across all Datadog language tracers that we are almost ready to ship and we'd like to sync it with the next release. That work is we expect to be ready next week, so that's our timeline as of now.

@marcotc
Copy link
Member

marcotc commented Jan 6, 2021

Thank you again for your work in this PR, @callumj. We've just released v0.44.0, which includes these changes. Let us know if you have any feedback with this new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Was opened by a community member integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants