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): trends hogql volume #15672

Merged
merged 41 commits into from
May 25, 2023
Merged

feat(insights): trends hogql volume #15672

merged 41 commits into from
May 25, 2023

Conversation

mariusandra
Copy link
Collaborator

@mariusandra mariusandra commented May 23, 2023

Problem

There are only a limited number of ways to display trends volume.

Changes

Adds HogQL expressions

2023-05-23 14 38 14

How did you test this code?

  • Added an E2E test
  • Added django unit test

@mariusandra
Copy link
Collaborator Author

I couldn't get person property access working easily. Proposing we launch it without. Just how to display this? 🤔

image

@mariusandra mariusandra marked this pull request as ready for review May 24, 2023 08:51
@mariusandra mariusandra requested a review from a team May 24, 2023 08:52
Comment on lines +128 to 131
math?: BaseMathType | PropertyMathType | CountPerActorMathType | GroupMathType | HogQLMathType
math_property?: string
math_hogql?: string
math_group_type_index?: 0 | 1 | 2 | 3 | 4
Copy link
Collaborator

Choose a reason for hiding this comment

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

In terms of data modeling, this should really be just one math property, as it doesn't make sense for e.g math_hogql to be set if math is not HogQLMathType – or vice versa.
Ideally this'd be like:
math: TrendsMath and then TrendsMath would be { type: HogQLMathType, expression: string } | { type: PropertyMathType, property: string } | ...
Not for this PR though I suppose.

Copy link
Collaborator

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Looks good to me, just found one tricky UI issue with truncating the expression in legends

if (math === 'hogql') {
return (
<Tag title={String(mathHogQL)}>
{String(mathHogQL).length > 10 ? `${mathHogQL?.substring(0, 10)}...` : String(mathHogQL ?? '')}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The 10 character limit is a bit frustrating, having just played around with this. It's short enough that even something extremely trivial like sum(property.amount) gets cut off, which makes those legends effectively useless. Can we relax this limit? Ideally relying on CSS

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense! How about max-w-60 text-ellipsis overflow-hidden?

image

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

3 snapshot changes in total. 0 added, 3 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

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