-
Notifications
You must be signed in to change notification settings - Fork 94
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
fix(spans): Scrub RELEASE SAVEPOINT statements #3091
Conversation
@@ -492,7 +497,6 @@ impl VisitorMut for NormalizeVisitor { | |||
} | |||
} | |||
} | |||
|
|||
_ => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of this catch all, if in the future the library introduces new values to the enum it won't compile and we know we have to check something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We absolutely should. I already started doing it and then gave up because there are so many match arms. But I guess I'll just power through.
relay-event-normalization/src/normalize/span/description/sql/parser.rs
Outdated
Show resolved
Hide resolved
Statement::CreateExtension { name, .. } => Self::scrub_name(name), | ||
Statement::Flush { channel, .. } => *channel = None, | ||
Statement::Discard { .. } => {} | ||
Statement::SetRole { role_name, .. } => { | ||
if let Some(role_name) = role_name { | ||
Self::scrub_name(role_name); | ||
} | ||
} | ||
Statement::SetVariable { .. } => {} | ||
Statement::SetTimeZone { .. } => {} | ||
Statement::SetNames { | ||
charset_name, | ||
collation_name, | ||
} => { | ||
*charset_name = "%s".into(); | ||
*collation_name = None; | ||
} | ||
Statement::SetNamesDefault {} => {} | ||
Statement::ShowFunctions { filter } => Self::scrub_statement_filter(filter), | ||
Statement::ShowVariable { variable } => Self::simplify_compound_identifier(variable), | ||
Statement::ShowVariables { filter, .. } => Self::scrub_statement_filter(filter), | ||
Statement::ShowCreate { .. } => {} | ||
Statement::ShowColumns { filter, .. } => Self::scrub_statement_filter(filter), | ||
Statement::ShowTables { | ||
db_name, filter, .. | ||
} => { | ||
if let Some(db_name) = db_name { | ||
Self::scrub_name(db_name); | ||
} | ||
Self::scrub_statement_filter(filter); | ||
} | ||
Statement::ShowCollation { filter } => Self::scrub_statement_filter(filter), | ||
Statement::Use { db_name } => Self::scrub_name(db_name), | ||
Statement::StartTransaction { .. } => {} | ||
Statement::SetTransaction { .. } => {} | ||
Statement::Comment { comment, .. } => *comment = None, | ||
Statement::Commit { .. } => {} | ||
Statement::Rollback { savepoint, .. } => { | ||
if let Some(savepoint) = savepoint { | ||
Self::erase_name(savepoint); | ||
} | ||
} | ||
Statement::CreateSchema { .. } => {} | ||
Statement::CreateDatabase { | ||
location, | ||
managed_location, | ||
.. | ||
} => { | ||
*location = None; | ||
*managed_location = None; | ||
} | ||
Statement::CreateFunction { .. } => {} | ||
Statement::CreateProcedure { .. } => {} | ||
Statement::CreateMacro { .. } => {} | ||
Statement::CreateStage { comment, .. } => *comment = None, | ||
Statement::Assert { .. } => {} | ||
Statement::Grant { | ||
grantees, | ||
granted_by, | ||
.. | ||
} => { | ||
Self::simplify_compound_identifier(grantees); | ||
*granted_by = None; | ||
} | ||
Statement::Revoke { | ||
grantees, | ||
granted_by, | ||
.. | ||
} => { | ||
Self::simplify_compound_identifier(grantees); | ||
*granted_by = None; | ||
} | ||
Statement::Deallocate { name, .. } => { | ||
Self::scrub_name(name); | ||
} | ||
Statement::Execute { name, .. } => Self::scrub_name(name), | ||
Statement::Prepare { name, .. } => Self::scrub_name(name), | ||
Statement::Kill { id, .. } => *id = 0, | ||
Statement::ExplainTable { .. } => {} | ||
Statement::Explain { .. } => {} | ||
Statement::Merge { .. } => {} | ||
Statement::Cache { .. } => {} | ||
Statement::UNCache { .. } => {} | ||
Statement::CreateSequence { .. } => {} | ||
Statement::CreateType { .. } => {} | ||
Statement::Pragma { .. } => {} | ||
Statement::LockTables { tables } => { | ||
for table in tables { | ||
let LockTable { | ||
table, | ||
alias, | ||
lock_type: _, | ||
} = table; | ||
Self::scrub_name(table); | ||
if let Some(alias) = alias { | ||
Self::scrub_name(alias); | ||
} | ||
} | ||
} | ||
Statement::UnlockTables => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These have not caused high cardinality in the past, but it's better to list them explicitly in case a new variant is introduced.
sqlparser improved parsing capabilities, which made us rely on the fallback scrubber less. Unfortunately, In the case of savepoints, the fallback scrubber caught more than the parser-based scrubber.
Reverts #3083
Fixes #3085