Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkakkar committed Oct 1, 2024
1 parent 9e284ad commit 7212632
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
9 changes: 2 additions & 7 deletions frontend/src/scenes/error-tracking/ErrorTrackingFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ import { errorTrackingSceneLogic } from './errorTrackingSceneLogic'

export const FilterGroup = (): JSX.Element => {
const { filterGroup, filterTestAccounts, searchQuery } = useValues(errorTrackingLogic)
const { setFilterGroup, setFilterTestAccounts, setSearchQueryDebounced } = useActions(errorTrackingLogic)
const { setFilterGroup, setFilterTestAccounts, setSearchQuery } = useActions(errorTrackingLogic)

return (
<div className="flex flex-1 items-center justify-between space-x-2">
<div className="flex items-center gap-2">
<LemonInput
type="search"
placeholder="Search..."
value={searchQuery}
onChange={setSearchQueryDebounced}
/>
<LemonInput type="search" placeholder="Search..." value={searchQuery} onChange={setSearchQuery} />
<UniversalFilters
rootKey="error-tracking"
group={filterGroup}
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/scenes/error-tracking/errorTrackingLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const errorTrackingLogic = kea<errorTrackingLogicType>([
setFilterGroup: (filterGroup: UniversalFiltersGroup) => ({ filterGroup }),
setFilterTestAccounts: (filterTestAccounts: boolean) => ({ filterTestAccounts }),
setSearchQuery: (searchQuery: string) => ({ searchQuery }),
setSearchQueryDebounced: (searchQuery: string) => ({ searchQuery }),
setSparklineSelectedPeriod: (period: string | null) => ({ period }),
_setSparklineOptions: (options: SparklineOption[]) => ({ options }),
}),
Expand Down Expand Up @@ -125,9 +124,5 @@ export const errorTrackingLogic = kea<errorTrackingLogicType>([
actions._setSparklineOptions([])
}
},
setSearchQueryDebounced: async ({ searchQuery }, breakpoint) => {
await breakpoint(30)
actions.setSearchQuery(searchQuery)
},
})),
])
12 changes: 7 additions & 5 deletions posthog/hogql_queries/error_tracking_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ 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:
Expand All @@ -145,12 +148,11 @@ def where(self):
)
)

if or_exprs:
exprs.append(
ast.Or(
exprs=or_exprs,
)
exprs.append(
ast.Or(
exprs=or_exprs,
)
)

return ast.And(exprs=exprs)

Expand Down
16 changes: 16 additions & 0 deletions posthog/hogql_queries/test/test_error_tracking_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,22 @@ def test_search_query(self):
self.assertEqual(results[0]["fingerprint"], ["DatabaseNotFound"])
self.assertEqual(results[0]["occurrences"], 1)

def test_empty_search_query(self):
runner = ErrorTrackingQueryRunner(
team=self.team,
query=ErrorTrackingQuery(
kind="ErrorTrackingQuery",
fingerprint=None,
dateRange=DateRange(),
filterTestAccounts=False,
searchQuery="probs not found",
),
)

results = self._calculate(runner)["results"]

self.assertEqual(len(results), 0)

@snapshot_clickhouse_queries
def test_fingerprints(self):
runner = ErrorTrackingQueryRunner(
Expand Down

0 comments on commit 7212632

Please sign in to comment.