-
Notifications
You must be signed in to change notification settings - Fork 440
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
contrib/go-redis/redis.v8: Allow Option To Remove Raw Tag #1022
Comments
Sorry for the late reply. This is fine. Thanks for opening the PR. |
Can you explain in more detail how this causes problems? The agent quantizes and obfuscates these values, so ultimately a command will look exactly like this (including the ellipsis): Regarding long commands being a problem: the only place where a "long" command would travel is locally between the tracing client (app) and the agent. Is that an issue? Or, is the problem memory usage in the application because of this string? Can you share a snippet of code? It might be that we can obtain the span from context and change it's raw command or resource today, programmatically, without introducing new options and having you wait for a new release. Regardless, it is fine if you want to skip the setting of this tag by means of an option, but I don't think we should skip the resource name. If we do that, everything will just be called |
From @shannontan-bolt in #1026:
Let's solve this issue then, if this is the real issue. First, I'd like to understand what about it is the issue:
Let's better define the issue and then we can find the right solution. |
Both are/were issues. I'm on my phone, apologies for the terseness. To be clear, if it is obfuscated for resource name, that's fine. I'm not sure how it would intelligently obfuscate based on the raw command, but if it does great.
So both are very real issues to me, and I've both disabled the tracing library and filtered out ingested spans to avoid any security issues. I only included the resource name change because it uses the same full command whereas I believe the operation name just uses the type of Redis command. |
I didn't get notified for your comment a few days ago. Within the UI, I suppose it is possible that the resource name is fine with the raw command, but I'm not certain now since I've had to disable the Redis trace. Maybe it was Redis.raw_command that was the source of both memory issues and presenting sensitive data. I also can't provide a snippet but I would believe that a sufficiently large JSON should trigger this issue. Our code caches responses of variable size from an HTTP call we make to a vendor, so not really much to share other than these fit just fine within our Redis instance. |
Ok. Thanks for explaining. I am also sorry for taking so long to respond. I can assure you it was not intentional. I'd really appreciate it if we could try a few things first so we can clearly define the issue before we start thinking about the right solution. The resource name should be quantized in the Datadog Agent, basically if you have something like However, for the raw command (I was wrong here), it only gets obfuscated if this setting is enabled in the Datadog Agent. The config is: apm_config:
obfuscation:
redis:
enabled: true Can you give this a try? Unfortunately this setting can not be applied via an env. var. right now, so I'm hoping you can alter the That should resolve the security issue.
This is the concerning part that I'd like to better understand. I can only imagine this could've been due to memory usage. In which case, we could introduce something like you already have in your PR: As for the resource, we could try something like WDYT? |
@gbbr, I can't test the resource name part without the change to the DisableRawCommand, at least not in any live env. I suppose I can make it work in a testing/local env but that requires work, so first I'd like to ask the following:
|
What I'm proposing is that your PR adds
I suspect this would solve the issue for you. What do you think?
They evolved differently as Datadog grew and developed as a product. We use the resource name as an aggregate as you may have already seen. To reduce cardinality and to make more sense, it was quantized by truncating everything after the command and adding the ellipsis ( |
Sorry if my previous answer is confusing, to summarise: I'm proposing to change your PR to only remove the raw command, but leave the resource as it is. Would that be fine for you? |
This is still confusing :) ResourceName tag appears to be set twice.
tracer.ResourceName is:
I think my end state here would be:
|
@gbbr, I reread your comment - maybe I'm confused because you edited your comment. Are you saying that we should still remove the second ResourceName set completely and use the flag as originally proposed on whether to send the raw command? |
Oh my! I think we've likely missed this and it is most definitely a (dangerous) error! I agree with your end state proposal. I think we're on the same page. To reiterate, what I'm understanding:
IIUC, let's do it 🚀 |
I agree - would it be possible if you could put the PR together or edit my PR? I still find it a bit of struggle to get my local system working and it keeps insisting on a ton of changes to go.mod/sum + not running tests. I'm not sure why but don't quite have the time to address it whereas I'm sure it is trivial for you. |
…urce This change adds a new option called `WithSkippedRawCommand` which determines the instrumentation code to skip adding the `redis.raw_command` tag to spans. This is useful in cases when the Datadog Agent Redis obfuscation is disabled (which it is, by default) and commands may contain sensitive information. Additionally, duplicate entries and an incosistency was found when setting the resource name for Redis spans, which was fixed as part of this PR. Closes #1022
@shannontan-bolt please review it: #1091 |
…urce This change adds a new option called `WithSkippedRawCommand` which determines the instrumentation code to skip adding the `redis.raw_command` tag to spans. This is useful in cases when the Datadog Agent Redis obfuscation is disabled (which it is, by default) and commands may contain sensitive information. Additionally, duplicate entries and an incosistency was found when setting the resource name for Redis spans, which was fixed as part of this PR. Closes #1022
…urce (#1091) This change adds a new option called `WithSkippedRawCommand` which determines the instrumentation code to skip adding the `redis.raw_command` tag to spans. This is useful in cases when the Datadog Agent Redis obfuscation is disabled (which it is, by default) and commands may contain sensitive information. Additionally, duplicate entries and an incosistency was found when setting the resource name for Redis spans, which was fixed as part of this PR. Closes #1022
@gbbr per this comment above: #1022 (comment)
Has an env var been added yet for this? I haven't yet been able to find one. If it has been added is it possible to point me in the direction for it? |
I believe there's a case where if the command is sufficiently large, this will cause serious memory issues on the client. Not only that, I believe this should be optional because in certain cases, this could be a security issue. Therefore, we should allow an option to remove the raw tag.
To refresh, see snippet from the contrib hook. See the
raw_command
part.The implementation of
cmd.String()
(I believe) boils down to this. You can see that it contains args.Interestingly, there's been a similar feature request and subsequent revert for memcache:
We've been able to isolate the problem to tracing by removing Redis tracing from the codepath that OOM'ed our servers without issue. But we haven't been able to dive into it in a more granular fashion than that. Happy to be told I'm wrong.
The text was updated successfully, but these errors were encountered: