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(data-exploration): bugfixes and improvements #13461

Merged
merged 23 commits into from
Dec 23, 2022

Conversation

mariusandra
Copy link
Collaborator

@mariusandra mariusandra commented Dec 22, 2022

Problem

Data exploration is not over the line yet, which means it's not live and enabled for some users.

Changes

Tries to take it over the line. In scope (might change):

  • fix persons search
  • add "full: true" to the nodes
  • replace EventsNode with EventsQuery everywhere, except insight nodes
  • restore load more
  • restore load new
  • api request cancellation into dataNodeLogic
  • add query running time next to "reload" button (behind a flag)

It should again work stable enough that we can enable the flag for ourselves.

Will get to in the next PR

Planned to, but didn't manage to get this in here.

  • add a date filter on top of the events scene (date_from & date_to !== before & after, need some unfangling)
  • add date in-between rows - fixes Regressions in new data table component #13223 - but I'm still not convinced we should do it - you either have so many events the day boundary is invisible, or so few that you only see day boundaries every few lines... I'm not sure it makes a lot of sense for both cases to show this, but I'll make something. I'll probably be a hack into LemonTable, renderInBetweenRowOrNull(prev, next) or something like that
  • convert cells to filters on click

Out of scope for now

  • Unfangling query_event_list.py and event.py
  • Add "unique users count" aggregation, and the other new ones

How did you test this code?

@mariusandra mariusandra marked this pull request as draft December 22, 2022 08:32
@mariusandra mariusandra marked this pull request as ready for review December 22, 2022 15:49
@mariusandra mariusandra requested review from thmsobrmlr and pauldambra and removed request for thmsobrmlr December 22, 2022 16:03
Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

A few thoughts but nothing blocking

(I didn't run this :D)

As discussed at standup really we need at least E2E tests on this. Would be good for the storybook section to have a "how do I start using data exploration" page too

@@ -74,11 +71,13 @@ const PropertyFormulas: EventsQuery = {

const PropertyFormulasTable: DataTableNode = {
kind: NodeKind.DataTableNode,
full: true,
Copy link
Member

Choose a reason for hiding this comment

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

Is this something more like showAllTableChrome?

full feels too vague

Copy link
Collaborator Author

@mariusandra mariusandra Dec 23, 2022

Choose a reason for hiding this comment

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

Normally I'd agree, but in this case I'm hoping we can convert this into a common notation that's easy to use everywhere.

E.g. { kind: 'DataTableNode', full: true, source: {} }, { kind: 'SessionRecording', full: true, id: 'http://' }, { kind: 'InsightViz', full: true, source: {} }

If you pass full: true, you get the full scene with our curated set of widgets and tools. Without full, we just display the element (recording, graph, etc). Then you can control it more with various showBla: true.

I wanted it to be different from the other showOneThing keywords. I thought about "Chrome", but 1) it's a browser sadly and I do know where its name comes from, 2) some of the OtherThings in showOtherThings are not "chrome".

When in doubt, the simpler solution wins, so full it was 😅

actions.setElapsedTime(performance.now() - now)
return data
} catch (e: any) {
cache.abortController = null
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 think we need to reset the abortController.

It's safe to call abort after a call is finished, and we reset to a new controller when we start the next API request

loadData: async () => {
return (await query<DataNode>(values.query)) ?? null
loadData: async (_, breakpoint) => {
if (cache.abortController) {
Copy link
Member

Choose a reason for hiding this comment

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

We also need to be able to trigger the abort from outside the component. There are two triggers

  1. (covered here) a new API request is started
  2. In case of navigating away from a page

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added an abortQuery action

} catch (e: any) {
cache.abortController = null
if (e.name === 'AbortError' || e.message?.name === 'AbortError') {
return values.response
Copy link
Member

Choose a reason for hiding this comment

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

we also need to call in to the cancel API with a query id when the API call is cancelled so we can release any ongoing ClickHouse resource usage

Copy link
Member

Choose a reason for hiding this comment

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

And we need to make sure this is reporting timeToSee data too.

Although fine to do all of this as follow-up since this is behind a flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

happy to do this in a followup 😅

if (values.autoLoadRunning) {
actions.stopAutoLoad()
}
if (cache.abortController) {
Copy link
Member

Choose a reason for hiding this comment

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

For simplicity, I've removed this elsewhere. In practice turbo mode means we're not unmounting the logics early enough to make a difference

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm... makes sense, though if all data goes through this dataNodeLogic, then we'll have cases where cancelling this before unmount will pay off... So I'd keep it. I changed it a bit to go through a new abortQuery action

@mariusandra
Copy link
Collaborator Author

Thanks for the reviews! I cleaned up a few things, and already had to merge with master. Since this PR lightly touches a lot of files (most of which are behind a flag), and fixes a few bad bugs, I'd happily merge this in and volunteer for oncall support for it over the next days 😅. Otherwise I fear work on other data exploration tasks next week will yield in a lot of annoying merge conflicts...

@mariusandra mariusandra merged commit a4ab4ea into master Dec 23, 2022
@mariusandra mariusandra deleted the data-exploration-final-vol2-thisisit--2 branch December 23, 2022 14:56
pauldambra pushed a commit that referenced this pull request Dec 28, 2022
* update schema

* slight touchups

* always use the latest query from props

* useCallback to memoise setQuerySource

* handroll some debouncing

* add full:true

* fixes

* make only EventsQuery-s queriable. EventsNode is just used in insights. Create HogQLExpression

* yeet EventsNode from data table, support loading next results

* get new results working again

* remove default sorting if editing the live events page

* fix test

* query cancellation

* show query time in the interface

* load next people

* more fixes

* more fixes

* last touchers

* fix sorting again

* combine some aborting
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.

None yet

3 participants