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

Lettuce 5.1 instrumentation should log normalised commands as db.statement #1405

Merged
merged 3 commits into from
Oct 20, 2020

Conversation

mateuszrzeszutek
Copy link
Member

Resolves #1386

import java.util.Map;

/** This class is responsible for masking potentially sensitive data in Redis commands. */
public final class RedisCommandNormalizer {
Copy link
Member Author

Choose a reason for hiding this comment

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

This class can be reused by other Redis libraries' instrumentations; I'll move it to some common package (javaagent-api?) in next PR and call it whenever args are available. Currently lettuce 5.1 is the only Redis lib instrumentation that logs actual statement, not just the bare command.

Copy link
Member Author

Choose a reason for hiding this comment

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

"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "SET a ?"
Copy link
Contributor

Choose a reason for hiding this comment

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

The rendering is a great improvement, thanks! But the spec seems to include argument values for statements

https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/database.md#redis

I don't know if this is a good idea though - do you mind filing a spec issue to discuss the PII implications and adding scrubbing to the spec?

Copy link
Contributor

Choose a reason for hiding this comment

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

Forgot to mention the improved rendering is very nice!

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is in accordance with spec - see db.statement attribute spec:

[3]: The value may be sanitized to exclude sensitive information.

Still, I think that this could be described in a more clear and explicit way. I'll create a spec issue to add an example for masking/sanitization.

Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to mention the improved rendering is very nice!

Thanks 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Mateusz Rzeszutek and others added 2 commits October 19, 2020 12:08
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
@trask trask merged commit f077b23 into open-telemetry:master Oct 20, 2020
@mateuszrzeszutek mateuszrzeszutek deleted the normalise-lettuce-5.1 branch November 18, 2022 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lettuce 5.1 instrumentation should log normalised commands as db.statement
3 participants