Skip to content

Conversation

@thomheymann
Copy link
Contributor

@thomheymann thomheymann commented Mar 24, 2025

Summary

Streams landing page improvements:

  • Added table view for wired and classic streams
  • Added documents count and histogram column (loaded asynchronous)
  • Added time range picker to change view
  • Added effective retention policy column
  • Added pagination
  • Added granular loading states
  • Added empty state with link to onboarding page

Screenshots

Streams-Observability-Elastic-03-24-2025_10_07_AM

Streams-Observability-Elastic-03-24-2025_10_08_AM

@thomheymann thomheymann changed the title 180 streams landing page improvements Streams landing page improvements Mar 24, 2025
@elastic elastic deleted a comment from elasticmachine Mar 24, 2025
@thomheymann thomheymann marked this pull request as ready for review March 24, 2025 12:45
@thomheymann thomheymann requested a review from a team as a code owner March 24, 2025 12:45
@thomheymann thomheymann added backport:version Backport to applied version labels v8.19.0 v9.1.0 release_note:skip Skip the PR/issue when compiling release notes labels Mar 24, 2025
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Looks pretty good already!

Some nits:

It seems like a single bar isn't rendered in the histogram, not sure why - it seems like we have the same issue on the /app/streams/<stream name>/overview page as well. We can also solve it later, but we should definitely fix - the Lens chart in Discover doesn't have the same problem.

Last 24 hours:
Screenshot 2025-03-24 at 17 54 51

Last 2 hours:
Screenshot 2025-03-24 at 17 55 26

The loading state looks pretty blocky - not sure how to improve, but it feels like there are some low hanging fruits here (maybe something design can help with as well?):
loading_state

I noticed that when switching around or using the filter, it's very easy to do the same ESQL query over and over again. We could think about a client side cache here, but it's probably overkill since these requests are fast and also cached on the Elasticsearch side. Something for a follow-up if even that.

indexPattern,
numDataPoints,
}: {
timefilter: TimefilterHook; // Workaround to keep state in sync
Copy link
Contributor

Choose a reason for hiding this comment

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

why this workaround? I guess alternatively we could call the hook in this compoent itself, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't use the useTimerange hook more than once on the page since it uses local state and we need the time range to be in sync across the entire page.

I would suggest to create a Provider/hook that keeps the state in global context.

Copy link
Contributor

Choose a reason for hiding this comment

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

They should all synchronize through the global timefilter service which is part of the data plugin (this is also what retains the current time range when moving from page to page within the streams UI):

I'm not sure about the overhead though, a provider would work too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are only synchronised at the time filter service level.
The absolute time is set by the hook using local state so that is not in sync between different instances of the hook.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, the absolute time range would have small differences across the different visualizations, that is indeed weird. Passing it in works fine I guess - ideally the absolute time range should be controlled centrally in the service as well, but oh well.

);

const docCount = allTimeseries.reduce(
(acc, series) => acc + series.data.reduce((acc2, item) => acc2 + (item.doc_count || 0), 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't matter for the classic streams, but there is a detail here we need to think about for wired streams - should we show the count for the stream and its children or just for the current layer? @LucaWintergerst any opinions here?

onQuerySubmit={({ dateRange }, isUpdate) => {
if (dateRange && isUpdate) {
timefilter.setTimeRange(dateRange);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should refreshAbsoluteTimeRange be in an else branch here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. I want the absolute time range to be refreshed irregardless of whether the relative time range changed. For example when a user has now-15s selected, opens the time range picker and selects the same range again I think the histograms should refresh based on that selection.

Copy link
Contributor

Choose a reason for hiding this comment

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

setTimeRange is implicitly updating the absolute time range as well, right? It updates the timefilter service and that in turn updates the absolute time range here:

setAbsoluteTimeRange(() => timefilter.getAbsoluteTime());

Not sure whether it matters, just stood out to me.

Copy link
Contributor Author

@thomheymann thomheymann Mar 25, 2025

Choose a reason for hiding this comment

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

The hook is currently a half way house between both approaches. Consumers need to explicitly refresh the absolute time when some interaction happens but the relative time range did not change (e.g. when selecting the same time range again or when clicking the refresh button or enabling auto-refresh). Consumers do not need to do this however when selecting a different time range. In that case the absolute time is refreshed automatically. This is fairly confusing. The behaviour should be consistent. I think the easiest approach from a consumer perspective would be to handle each of these cases for the user implicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and created a hook with context provider that solves most of the issues with the current implementation. Might make sense for the streams app search bar component to integrate with that natively so that we don't need to manually set the callback methods everywhere but we can do that incrementally when all the different use cases are clearer.

@flash1293
Copy link
Contributor

flash1293 commented Mar 25, 2025

@thomheymann You mentioned in Slack that the loading thing is delayed by 300ms - that's right, but the way it's used is that the old number doesn't stay around:

https://github.com/elastic/kibana/pull/215629/files#diff-046d92808c06a0cdea02f0d8eaf42e27f20f6297b8985e137fb897a4f30da98bR101

Try to just hit refresh, and the old value will disappear immediately, then after 300ms the loading skeleton will appear. That's the jumpy behavior I was referring to. We should keep the old value in view until the skeleton is shown

@thomheymann thomheymann requested a review from flash1293 March 26, 2025 10:42
@flash1293
Copy link
Contributor

@thomheymann did you address this point somewhere? #215629 (comment)

@thomheymann
Copy link
Contributor Author

@thomheymann did you address this point somewhere? #215629 (comment)

How would you expect this work instead?

@flash1293
Copy link
Contributor

flash1293 commented Mar 27, 2025

How would you expect this work instead?

If the state switches to loading, the old value is still shown for 300ms. If the request returns within these 300ms, we update it right away, otherwise we go to the spinner. Right now if you change the time range, we immediately hide the old value and show an empty cell, then after 300ms we show the skeleton.

If the value returns quickly that causes all numbers all charts to blink.

I put up a version of what I mean here: thomheymann#2

You can go even further than that and make it nicer for edge cases, but there are diminishing returns IMHO - I was mostly triggered by the blinking.

Current state

Fast refresh time (everything blinks):

old_fast_refresh

Slow refresh time (show nothing for 300ms, then the skeleton):

old_slow_request

Keep old value for 300ms

Fast refresh time (update everything in place):

fast_refresh

Slow refresh time (show old value for 300ms, then switch to skeleton, then to value):

slow_refresh

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix with the chart, LGTM I think it would be good to address the loading thing in my last comment, but nothing beyond that blocking the PR

@flash1293 flash1293 added Team:obs-onboarding Observability Onboarding Team Feature:Streams This is the label for the Streams Project labels Mar 27, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)

@thomheymann thomheymann enabled auto-merge (squash) March 27, 2025 11:05
@thomheymann thomheymann merged commit 8a29087 into elastic:main Mar 27, 2025
9 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #113 / Cloud Security Posture GET /internal/cloud_security_posture/stats CSPM Compliance Dashboard Stats API should return CSPM benchmarks V2

The CI Stats report is too large to be displayed here, check out the CI build annotation for this information.

History

@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/14106909123

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2025
## Summary

Streams landing page improvements:

- Added table view for wired and classic streams
- Added documents count and histogram column (loaded asynchronous)
- Added time range picker to change view
- Added effective retention policy column
- Added pagination
- Added granular loading states
- Added empty state with link to onboarding page

## Screenshots

![Streams-Observability-Elastic-03-24-2025_10_07_AM](https://github.com/user-attachments/assets/49379b26-3749-4707-bd1f-973650706d38)

![Streams-Observability-Elastic-03-24-2025_10_08_AM](https://github.com/user-attachments/assets/3d66c0c7-c17c-4382-a4e9-04fe5a2d1443)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 8a29087)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 27, 2025
# Backport

This will backport the following commits from `main` to `8.x`:
- [Streams landing page improvements
(#215629)](#215629)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Thom
Heymann","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-03-27T12:45:16Z","message":"Streams
landing page improvements (#215629)\n\n## Summary\n\nStreams landing
page improvements:\n\n- Added table view for wired and classic
streams\n- Added documents count and histogram column (loaded
asynchronous)\n- Added time range picker to change view\n- Added
effective retention policy column\n- Added pagination\n- Added granular
loading states\n- Added empty state with link to onboarding page\n\n##
Screenshots\n\n\n![Streams-Observability-Elastic-03-24-2025_10_07_AM](https://github.com/user-attachments/assets/49379b26-3749-4707-bd1f-973650706d38)\n\n\n![Streams-Observability-Elastic-03-24-2025_10_08_AM](https://github.com/user-attachments/assets/3d66c0c7-c17c-4382-a4e9-04fe5a2d1443)\n\n---------\n\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"8a29087d70a79a8f8bddddfe980c95e8163adbc5","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-logs","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"Streams
landing page
improvements","number":215629,"url":"https://github.com/elastic/kibana/pull/215629","mergeCommit":{"message":"Streams
landing page improvements (#215629)\n\n## Summary\n\nStreams landing
page improvements:\n\n- Added table view for wired and classic
streams\n- Added documents count and histogram column (loaded
asynchronous)\n- Added time range picker to change view\n- Added
effective retention policy column\n- Added pagination\n- Added granular
loading states\n- Added empty state with link to onboarding page\n\n##
Screenshots\n\n\n![Streams-Observability-Elastic-03-24-2025_10_07_AM](https://github.com/user-attachments/assets/49379b26-3749-4707-bd1f-973650706d38)\n\n\n![Streams-Observability-Elastic-03-24-2025_10_08_AM](https://github.com/user-attachments/assets/3d66c0c7-c17c-4382-a4e9-04fe5a2d1443)\n\n---------\n\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"8a29087d70a79a8f8bddddfe980c95e8163adbc5"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215629","number":215629,"mergeCommit":{"message":"Streams
landing page improvements (#215629)\n\n## Summary\n\nStreams landing
page improvements:\n\n- Added table view for wired and classic
streams\n- Added documents count and histogram column (loaded
asynchronous)\n- Added time range picker to change view\n- Added
effective retention policy column\n- Added pagination\n- Added granular
loading states\n- Added empty state with link to onboarding page\n\n##
Screenshots\n\n\n![Streams-Observability-Elastic-03-24-2025_10_07_AM](https://github.com/user-attachments/assets/49379b26-3749-4707-bd1f-973650706d38)\n\n\n![Streams-Observability-Elastic-03-24-2025_10_08_AM](https://github.com/user-attachments/assets/3d66c0c7-c17c-4382-a4e9-04fe5a2d1443)\n\n---------\n\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"8a29087d70a79a8f8bddddfe980c95e8163adbc5"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Thom Heymann <[email protected]>
cqliu1 pushed a commit to cqliu1/kibana that referenced this pull request Mar 31, 2025
## Summary

Streams landing page improvements:

- Added table view for wired and classic streams
- Added documents count and histogram column (loaded asynchronous)
- Added time range picker to change view
- Added effective retention policy column
- Added pagination
- Added granular loading states
- Added empty state with link to onboarding page

## Screenshots


![Streams-Observability-Elastic-03-24-2025_10_07_AM](https://github.com/user-attachments/assets/49379b26-3749-4707-bd1f-973650706d38)


![Streams-Observability-Elastic-03-24-2025_10_08_AM](https://github.com/user-attachments/assets/3d66c0c7-c17c-4382-a4e9-04fe5a2d1443)

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Streams This is the label for the Streams Project release_note:skip Skip the PR/issue when compiling release notes Team:obs-onboarding Observability Onboarding Team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants