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(dashboards): HogQL support for dashboard filters on insights with property group filters #21903

Merged
merged 7 commits into from
Apr 29, 2024

Conversation

Twixes
Copy link
Member

@Twixes Twixes commented Apr 26, 2024

Problem

HogQL apply_dashboard_filters only worked if the insight's query uses filters in list form – but typically these days, property filter groups are used. This failed (Sentry).

Changes

Fixed the bug.

How did you test this code?

Updated test_insight_refreshing_query to use a property filter group instead of just list.

@Twixes Twixes requested a review from a team April 26, 2024 16:17
@Twixes Twixes changed the title Add test for failing case fix(dashboards): HogQL support for dashboard filters on insights with propery group filters #21868 Apr 26, 2024
@Twixes Twixes changed the title fix(dashboards): HogQL support for dashboard filters on insights with propery group filters #21868 fix(dashboards): HogQL support for dashboard filters on insights with property group filters Apr 26, 2024
)
except Exception as e:
# If pydantic is unhappy about the shape of data, let's ignore property filters and carry on
capture_exception()
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious: Do we have Sentry configured to capture exception-level log message as exceptions? If so, we don't need to capture separately, as below is sufficient.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't, but there's a way: https://github.com/kiwicom/structlog-sentry

logger.error(
"Failed to apply dashboard property filters",
exception=e,
exc_info=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can also use logger.exception and then you don't need the exc_info=True

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yeah, that's exactly what I was looking for

@Twixes Twixes enabled auto-merge (squash) April 29, 2024 10:34
@Twixes Twixes merged commit 2b2b858 into master Apr 29, 2024
97 checks passed
@Twixes Twixes deleted the fix-hogql-apply-dashboard-filters-group-2 branch April 29, 2024 10:50
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.

2 participants