Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(spans): Detect db_system redis #3642

Merged
merged 3 commits into from
May 24, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions relay-event-normalization/src/normalize/span/description/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub(crate) fn scrub_span_description(
.and_then(|(op, sub)| match (op, sub) {
("http", _) => scrub_http(description),
("cache", _) | ("db", "redis") => scrub_redis_keys(description),
("db", _) if db_system == Some("redis") => scrub_redis_keys(description),
("db", sub) => {
if sub.contains("clickhouse")
|| sub.contains("mongodb")
Expand Down Expand Up @@ -1124,6 +1125,24 @@ mod tests {
assert_eq!(scrubbed.0.as_deref(), Some("SELECT a FROM b"));
}

#[test]
fn redis_with_db_system() {
let json = r#"{
"description": "del myveryrandomkey:123Xalsdkxfhn",
"op": "db",
"data": {
"db.system": "redis"
}
}"#;

let mut span = Annotated::<Span>::from_json(json).unwrap();

let scrubbed = scrub_span_description(span.value_mut().as_mut().unwrap());

// NOTE: this should return `DEL *`, but we cannot detect lowercase command names yet.
assert_eq!(scrubbed.0.as_deref(), Some("*"));
}

#[test]
fn core_data() {
let json = r#"{
Expand Down
Loading