Skip to content

Commit

Permalink
better way of warning when remaining properties are being queries
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Oct 19, 2024
1 parent e50be86 commit afa5568
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from typing import Any, NamedTuple, cast, Optional, Union
from datetime import datetime, timedelta

import posthoganalytics

from posthog.hogql import ast
from posthog.hogql.ast import CompareOperation
from posthog.hogql.parser import parse_select
Expand Down Expand Up @@ -47,6 +49,10 @@ class SessionRecordingQueryResult(NamedTuple):
timings: list[QueryTiming] | None = None


class UnexpectedQueryProperties(Exception):
pass


class SessionRecordingListFromFilters:
SESSION_RECORDINGS_DEFAULT_LIMIT = 50

Expand Down Expand Up @@ -244,9 +250,7 @@ def _where_predicates(self) -> Union[ast.And, ast.Or]:

remaining_properties = self._strip_person_and_event_and_cohort_properties(self._filter.property_groups)
if remaining_properties:
logger.info(
"session_replay_query_builder has unhandled properties", unhandled_properties=remaining_properties
)
posthoganalytics.capture_exception(UnexpectedQueryProperties(remaining_properties))
optional_exprs.append(property_to_expr(remaining_properties, team=self._team, scope="replay"))

if self._filter.console_log_filters.values:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3174,7 +3174,7 @@
FROM
(SELECT DISTINCT cohortpeople.person_id AS person_id, cohortpeople.cohort_id AS cohort_id
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 2), ifNull(in(tuple(cohortpeople.cohort_id, cohortpeople.version), [(1, 0)]), 0))) AS cohort_people
WHERE and(equals(cohortpeople.team_id, 2), ifNull(in(tuple(cohortpeople.cohort_id, cohortpeople.version), [(13, 0)]), 0))) AS cohort_people
WHERE ifNull(in(cohort_people.person_id,
(SELECT cohortpeople.person_id AS person_id
FROM cohortpeople
Expand Down Expand Up @@ -3249,7 +3249,7 @@
FROM
(SELECT DISTINCT cohortpeople.person_id AS person_id, cohortpeople.cohort_id AS cohort_id
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 2), ifNull(in(tuple(cohortpeople.cohort_id, cohortpeople.version), [(3, 0)]), 0))) AS cohort_people
WHERE and(equals(cohortpeople.team_id, 2), ifNull(in(tuple(cohortpeople.cohort_id, cohortpeople.version), [(15, 0)]), 0))) AS cohort_people
WHERE ifNull(in(cohort_people.person_id,
(SELECT cohortpeople.person_id AS person_id
FROM cohortpeople
Expand Down Expand Up @@ -3304,7 +3304,7 @@
FROM
(SELECT DISTINCT cohortpeople.person_id AS person_id, cohortpeople.cohort_id AS cohort_id
FROM cohortpeople
WHERE and(equals(cohortpeople.team_id, 2), ifNull(in(tuple(cohortpeople.cohort_id, cohortpeople.version), [(3, 0)]), 0))) AS cohort_people
WHERE and(equals(cohortpeople.team_id, 2), ifNull(in(tuple(cohortpeople.cohort_id, cohortpeople.version), [(15, 0)]), 0))) AS cohort_people
WHERE ifNull(in(cohort_people.person_id,
(SELECT cohortpeople.person_id AS person_id
FROM cohortpeople
Expand Down

0 comments on commit afa5568

Please sign in to comment.