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

fix(pattern): Fix mongodb patterns, assert all patterns in debug profile #4125

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Oct 9, 2024

Assert patterns for correctness in the debug profile. This caught the mongodb patterns to be broken because of unbalanced parenthesis.

Example failure of the MongoDB patterns:

---- metrics_extraction::event::tests::test_metrics_summaries_on_transaction_and_spans stdout ----
thread 'metrics_extraction::event::tests::test_metrics_summaries_on_transaction_and_spans' panicked at /home/runner/work/relay/relay/relay-pattern/src/typed.rs:185:18:
all patterns should be valid patterns: Error { pattern: "*[{*", kind: UnbalancedCharacterClass }

Fixing the mongodb patterns surfaced a bug in matching of the db.system, which is now also fixed.

#skip-changelog

@Dav1dde Dav1dde force-pushed the dav1d/assert-patterns-in-debug branch from 21a2951 to 6595a85 Compare October 9, 2024 10:30
@Dav1dde Dav1dde changed the title test(pattern): Assert all patterns when compiling in debug mode fix(pattern): Fix mongodb patterns, assert all patterns in debug profile Oct 9, 2024
@Dav1dde Dav1dde self-assigned this Oct 9, 2024
@Dav1dde Dav1dde marked this pull request as ready for review October 9, 2024 11:20
@Dav1dde Dav1dde requested a review from a team as a code owner October 9, 2024 11:20
@@ -117,7 +117,7 @@ pub fn hardcoded_span_metrics() -> Vec<(GroupKey, Vec<MetricSpec>, Vec<TagMappin
let is_db = RuleCondition::eq("span.sentry_tags.category", "db")
& !RuleCondition::glob("span.op", DISABLED_DATABASES)
// MongoDB queries are only allowed when `span.system` is set to `mongodb`.
& (RuleCondition::eq("span.system", "mongodb")
Copy link
Member

Choose a reason for hiding this comment

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

@mjq turns out this condition had the wrong field, which we did not notice because MONGODB_QUERIES contained an invalid pattern.

@Dav1dde Dav1dde force-pushed the dav1d/assert-patterns-in-debug branch from fcabd08 to 30f3324 Compare October 9, 2024 12:03
@Dav1dde
Copy link
Member Author

Dav1dde commented Oct 9, 2024

@jjbayer the span op fix, added a bunch of tags (and some metrics) for db spans, they seem alright to me but please double check.

Base automatically changed from dav1d/rm-glob3 to master October 9, 2024 12:57
@Dav1dde Dav1dde force-pushed the dav1d/assert-patterns-in-debug branch from 30f3324 to 69dc769 Compare October 9, 2024 12:58
@Dav1dde Dav1dde enabled auto-merge (squash) October 9, 2024 12:59
@Dav1dde Dav1dde merged commit 469e104 into master Oct 9, 2024
23 checks passed
@Dav1dde Dav1dde deleted the dav1d/assert-patterns-in-debug branch October 9, 2024 13:10
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.

3 participants