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

Funnel steps breakdown #4949

Merged
merged 17 commits into from
Jul 6, 2021
Merged

Funnel steps breakdown #4949

merged 17 commits into from
Jul 6, 2021

Conversation

EDsCODE
Copy link
Member

@EDsCODE EDsCODE commented Jun 30, 2021

Changes

Please describe.

  • adds ability to view broken down funnel steps (5 at a time)
  • only event and person prop breakdowns in this PR
  • api parameters are the same as for trends.
  • Current funnel step results [...funnel steps]. New funnel step with breakdown result" [[... funnels steps for breakdown value 1], [... funnels steps for breakdown value 2], ....]

If this affects the frontend, include screenshots.

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • Frontend/CSS is usable at 320px (iPhone SE) and decent at 360px (most phones)
  • Breaking changes are backwards-compatible. Ensure old/new frontend requests work with new/old backends, and vice versa.

@timgl timgl temporarily deployed to posthog-pr-4949 June 30, 2021 15:44 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 16:22 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 16:49 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 18:23 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 19:04 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 June 30, 2021 19:21 Inactive
@EDsCODE EDsCODE requested review from Twixes and neilkakkar July 1, 2021 14:58
@EDsCODE EDsCODE marked this pull request as ready for review July 1, 2021 15:14
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 1, 2021 15:15 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 1, 2021 18:46 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 1, 2021 20:05 Inactive
Copy link
Collaborator

@neilkakkar neilkakkar left a comment

Choose a reason for hiding this comment

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

Couple of small nits, looks good to me otherwise!

ee/clickhouse/queries/funnels/funnel.py Outdated Show resolved Hide resolved
ee/clickhouse/queries/funnels/funnel.py Outdated Show resolved Hide resolved
ee/clickhouse/queries/breakdown_props.py Outdated Show resolved Hide resolved
else:
return ""

def _get_breakdown_prop(self) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

small nit / not sure if worth tackling here since other discrepancies remain: we decided not to return query strings with a comma in the beginning.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will save that change for a later update where we adjust how the handling is done in all this query formatting

ee/clickhouse/queries/funnels/funnel.py Show resolved Hide resolved
@Twixes Twixes linked an issue Jul 5, 2021 that may be closed by this pull request
}

try:
top_elements_array_result = sync_execute(query, element_params)
Copy link
Collaborator

@Twixes Twixes Jul 6, 2021

Choose a reason for hiding this comment

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

Radical question: could the results of this class be achieved using CTEs, so that the broken down funnel calculation is a single SQL query without a round trip?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ooh, this in interesting: Completely missed the execution at the end of both prop_values functions.

I don't see why not, sounds like a reasonable suggestion!

Copy link
Member Author

Choose a reason for hiding this comment

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

unless they increased the support, but from what I remember clickhouse CTEs only allow you to use the reference in the immediate level below the CTE, so I dont think we're able to use the results of that CTE on the innermost query where we would need to do the filtering

Copy link
Collaborator

Choose a reason for hiding this comment

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

From what I've tried, they should work – though I may have missed something! I'd give this a go in any case, as even though this does not affect big-O, doing a round trip definitely is enough overhead to be degrading the experience for users.

@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 14:22 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 14:31 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 14:36 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 15:06 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-pr-4949 July 6, 2021 15:16 Inactive
@EDsCODE EDsCODE merged commit 708dcbb into master Jul 6, 2021
@EDsCODE EDsCODE deleted the funnel-steps-breakdown branch July 6, 2021 16:37
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.

Allow breaking down in funnels
4 participants