-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(errors): Allow searching for errors #25175
Changes from all commits
b65165d
98246ce
bb10a57
edcf420
aeba890
9c852fb
9e284ad
7212632
ef64396
8942524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,9 @@ def to_query(self) -> ast.SelectQuery: | |
|
||
def select(self): | ||
exprs: list[ast.Expr] = [ | ||
ast.Alias(alias="occurrences", expr=ast.Call(name="count", args=[])), | ||
ast.Alias( | ||
alias="occurrences", expr=ast.Call(name="count", distinct=True, args=[ast.Field(chain=["uuid"])]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daibhin found that due to the But anyhow, should make this case clear where we never doublecount events. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. merging since no real risk here, but let me know if you have thoughts on this change! |
||
), | ||
ast.Alias( | ||
alias="sessions", expr=ast.Call(name="count", distinct=True, args=[ast.Field(chain=["$session_id"])]) | ||
), | ||
|
@@ -126,6 +128,34 @@ def where(self): | |
), | ||
) | ||
|
||
if self.query.searchQuery: | ||
# TODO: Refine this so it only searches the frames inside $exception_list | ||
# TODO: Split out spaces and search for each word separately | ||
# TODO: Add support for searching for specific properties | ||
# TODO: Add fuzzy search support | ||
props_to_search = ["$exception_list", "$exception_stack_trace_raw", "$exception_type", "$exception_message"] | ||
or_exprs: list[ast.Expr] = [] | ||
for prop in props_to_search: | ||
or_exprs.append( | ||
ast.CompareOperation( | ||
op=ast.CompareOperationOp.Gt, | ||
Comment on lines
+140
to
+141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a concern for right now but maybe we could consider some degree of fuzzy matching in future There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice 👌 |
||
left=ast.Call( | ||
name="position", | ||
args=[ | ||
ast.Call(name="lower", args=[ast.Field(chain=["properties", prop])]), | ||
ast.Call(name="lower", args=[ast.Constant(value=self.query.searchQuery)]), | ||
], | ||
), | ||
right=ast.Constant(value=0), | ||
) | ||
) | ||
|
||
exprs.append( | ||
ast.Or( | ||
exprs=or_exprs, | ||
) | ||
) | ||
|
||
return ast.And(exprs=exprs) | ||
|
||
def group_by(self): | ||
|
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.
Agreed this makes sense as being separate to the
filterGroup