PostHog / meta

This is a place to discuss non-product issues in public.
MIT License
10 stars 4 forks source link

HogQL Insights #130

Open thmsobrmlr opened 9 months ago

thmsobrmlr commented 9 months ago

HogQL Insights

HogQL insights are now enabled for everyone, except for serialized insights and dashboards, which are still using the legacy system.

Remaining conversion

Experiments

Experiments use the PA code backend side to generate trends/funnel results. We should swap out the legacy implementation for the HogQL one there as well.

Finalize query schema

At some point we want to run a migration to replace filters with queries. After that migration it will be harder to make changes to the query schema, meaning we should clean up the schema as good as we can now.

Unfortunately this got complicated by the fact that notebooks already save insights as queries and not filters. Thus they need additional handling in https://github.com/PostHog/posthog/blob/master/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts and we need to come up with a way to clean up tech debt there. The queries are stored both in the notebook nodes and in the activity log from which the user can go back in time.

Some proposed changes to the current query schema:

Remove frontend side dependency on filters

We can get rid of filters frontend side first by using the backend side filter_to_query function to return only queries from insights (and any other places that might return filters) and adapting the frontend so that it only handles queries. For saving insights we can use the frontend side queryNodeToFilters function to send finally send filters to the backend.

Related bugs

Trends

Funnels

Retention

Cleanup

Make it flippin' amazing

thmsobrmlr commented 4 months ago

Consolidation 1.3.2024

Step 1: Make it work

https://github.com/PostHog/posthog/pull/17295 & https://github.com/PostHog/posthog/pull/17414 & https://github.com/PostHog/posthog/pull/17440

To have a scaffold for other queries and to enable discussion on implementation details, we want to have the lifecycle query ported over to HogQL from frontend to the backend and back i.e.

Step 2. Make it good

Step 3. Make it complete

image

MarconLP commented 2 months ago

related issue: https://posthoghelp.zendesk.com/agent/tickets/12480

MarconLP commented 2 months ago

related issue: https://posthoghelp.zendesk.com/agent/tickets/12609

thmsobrmlr commented 3 weeks ago

Consolidated post-HogQL-insights points on 2024-04-23 & 2024-06-05

Trends

Known issues with the HogQL implementation of trends:

Known issues with the HogQL implementation of funnels:

Correlation

Lifecycle

Paths