-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat(spans): Allow activerecord with db.system #2545
Conversation
@@ -47,7 +47,6 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) { | |||
inner: Box::new(RuleCondition::Glob(GlobCondition { | |||
name: span_op_field_name.into(), | |||
value: GlobPatterns::new(vec![ | |||
"*active*record*".into(), |
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 now allow metrics from active record spans.
if sub.contains("clickhouse") | ||
|| sub.contains("mongodb") | ||
|| sub.contains("redis") | ||
|| is_legacy_activerecord(sub, db_system) |
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.
When active record does not provide a db.system
, we cannot parse it, so provide no scrubbed description at all.
|| op.contains("redis")) | ||
&& !(op == "db.sql.query" && !(description.contains(r#""$"#) || system == "mongodb")) | ||
&& !(op.contains("clickhouse") || op.contains("mongodb") || op.contains("redis")) | ||
&& !(op == "db.sql.query" && (description.contains(r#""$"#) || system == "mongodb")) |
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.
Drive by fix: There was a double negation here that included db.sql.query
only for mongodb.
(&COMMENTS, "\n"), | ||
(&INLINE_COMMENTS, ""), | ||
(&NORMALIZER_REGEX, "$pre%s"), |
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.
Comments may contain string delimiters ('
), and strings may contain comment delimiters. So no matter how we order the regexes, one can construct a case where scrubbing does not work. Prefer this order for now because we've seen that the previous order destroyed active record descriptions.
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.
lgtm!
* master: feat(spans): Allow activerecord with db.system (#2545) ref(sampling): Replace Evaluator with ControlFlow. (#2544) Add main cluster to gocd pop jobs (#2529) build(actions): Bump `checkout` action to v4 (#2539) fix(beta): Address beta lint warnings (#2541) fix(spans): Detect ODBC escape sequence with regex (#2543)
We've seen SQL query normalization fail when the queries are prepended with an active record comment, for example
Normalization works fine when
sqlparser
is able to parse the query though. Having adb.system
inspan.data
is a strong indicator that we will be able to parse the query. So we re-allow activerecord spans if they have adb.system
set.In addition, this PR also improves the fallback regex behavior for this kind of comments.
ref: internal issue