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

feat(insights): compare legacy and hogql insights #18628

Merged
merged 17 commits into from
Dec 22, 2023

Conversation

mariusandra
Copy link
Collaborator

Problem

We want to launch HogQL trend and lifecycle insights. We also want to make sure the data is the same between the two.

Changes

Adds a management command that compares a set of lifecycle insight results.

How did you test this code?

I ran this in the python shell directly. I'll keep tweaking and running it like that for now. This PR is just a snapshot and likely won't get merged.

Copy link
Contributor

Size Change: 0 B

Total Size: 2.01 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 2.01 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

@mariusandra
Copy link
Collaborator Author

This is just a management command that's not run from anywhere, but is useful when comparing HogQL results between teams. Let's get it in, and possibly expand with other queries as we finish them.

@mariusandra mariusandra requested a review from a team December 22, 2023 08:10
Copy link
Contributor

@webjunkie webjunkie left a comment

Choose a reason for hiding this comment

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

I made a lifecycle insight and got
posthog.hogql.errors.HogQLException: Unknown CompareOperationOp: InCohort
Not sure what that is.

But, yeah, can still be a useful command.

from posthog.hogql_queries.query_runner import get_query_runner

insights = (
Insight.objects.filter(filters__contains={"insight": "LIFECYCLE"}, saved=True, deleted=False, team_id=2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why team 2? For me it's 1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's what we have in production on the US cloud. The next version of this query should just check for all teams.

@mariusandra
Copy link
Collaborator Author

I made a lifecycle insight and got posthog.hogql.errors.HogQLException: Unknown CompareOperationOp: InCohort Not sure what that is.

Oh, seems like you found a bug: lifecycle insights with cohort filters fail. Will fix.

@webjunkie
Copy link
Contributor

I made a lifecycle insight and got posthog.hogql.errors.HogQLException: Unknown CompareOperationOp: InCohort Not sure what that is.

Oh, seems like you found a bug: lifecycle insights with cohort filters fail. Will fix.

Ah, I just got super confused since it works in the frontend. Turns out it's one of my insights, but not the one I created right before.

@mariusandra
Copy link
Collaborator Author

Fixed here: #19501

Copy link
Contributor

@webjunkie webjunkie left a comment

Choose a reason for hiding this comment

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

Runs now for me. Let's get it in.

@mariusandra mariusandra merged commit fabbddb into master Dec 22, 2023
71 checks passed
@mariusandra mariusandra deleted the hogql-lifecycle-comparison branch December 22, 2023 12:41
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.

3 participants