Skip to content

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

Merged
trask merged 3 commits intoopen-telemetry:masterfrom
mateuszrzeszutek:normalise-lettuce-5.1
Oct 20, 2020
Merged

Lettuce 5.1 instrumentation should log normalised commands as db.statement#1405
trask merged 3 commits intoopen-telemetry:masterfrom
mateuszrzeszutek:normalise-lettuce-5.1

Conversation

@mateuszrzeszutek
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@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
schmikei pushed a commit to schmikei/opentelemetry-java-instrumentation that referenced this pull request Apr 17, 2025
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