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: warn users of things that can make insights slow #28691

Merged
merged 6 commits into from
Feb 14, 2025

Conversation

raquelmsmith
Copy link
Member

Problem

Users with a lot of data can run into slow insights because they aren't aware of specific things that can make loading slow.

Changes

Shows a list of things specific to that insight that can help with loading times. Only shows this list if the insight takes > 7 seconds to load, and the sampling if only after 12 seconds.

Why 7 and 12? I sat and stared at these for a while and those intervals felt correct.

Screen.Recording.2025-02-13.at.11.44.03.AM.mov

Here are some other screenshots of the different states:

Arc 2025-02-13 11 56 37

Arc 2025-02-13 11 57 19

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

Should

How did you test this code?

👀

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds functionality to warn users about slow-loading insights by detecting performance bottlenecks and providing targeted optimization suggestions.

  • Added loading time tracking in dataNodeLogic.ts with thresholds at 7 and 12 seconds to trigger different levels of suggestions
  • Implemented SlowQuerySuggestions component in EmptyStates.tsx to display actionable optimization tips based on query type
  • Added detection for slow query patterns (All events, First time for user, Strict funnel) in insightDataLogic.tsx
  • Created SlowQueryPossibilities type to standardize the categorization of slow query causes

💡 (3/5) Reply to the bot's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

Size Change: 0 B

Total Size: 1.2 MB

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

compressed-size-action

Copy link
Contributor

@adamleithp adamleithp left a comment

Choose a reason for hiding this comment

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

I think @rafaeelaudibert is going to revert this component.... but I do like this a lot more

@raquelmsmith
Copy link
Member Author

I don't think he will revert the entire component, just the style changes he made, right?

@rafaeelaudibert
Copy link
Member

I can work around the new changes, I like them a lot. Let's merge this, and then I can work on reverting some (some being a keyword) of the styling changes.

@raquelmsmith raquelmsmith merged commit b521fcf into master Feb 14, 2025
104 checks passed
@raquelmsmith raquelmsmith deleted the feat/slow-insight-warnings branch February 14, 2025 13:59
Copy link
Member

@rafaeelaudibert rafaeelaudibert left a comment

Choose a reason for hiding this comment

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

I'd make the text much smaller, I think it's using way too much space now, see comparison between before/now for example

image

@@ -741,6 +751,20 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
}, AUTOLOAD_INTERVAL)
}
},
dataLoading: (dataLoading) => {
Copy link
Member

Choose a reason for hiding this comment

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

I don't see us cleaning up this when we actually finish loading the data, we just clean it up when we unmount, is this right?

@rafaeelaudibert
Copy link
Member

Will do some clean up and add my suggested changes ☝🏻 in my follow-up PR

@raquelmsmith
Copy link
Member Author

Ah sorry about the text sizing!

HamedMP pushed a commit that referenced this pull request Feb 19, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants