[ObsUX] Add Profiling tab to Asset Details#171764
[ObsUX] Add Profiling tab to Asset Details#171764mykolaharmash merged 9 commits intoelastic:mainfrom
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
273f886 to
885c8d4
Compare
285093f to
163ce8d
Compare
|
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
163ce8d to
f6b1119
Compare
|
I left out API tests for now as I could not generate a good profiling data archive to test against. Will try to figure it out in the upcoming changes. |
| const { loading, response, makeRequest } = useHTTPRequest<BaseFlameGraph>( | ||
| '/api/infra/profiling/flamegraph', | ||
| 'POST', | ||
| JSON.stringify(InfraProfilingRequestParamsRT.encode(body)), | ||
| undefined, | ||
| undefined, | ||
| undefined, | ||
| true | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
| makeRequest(); | ||
| }, [makeRequest]); |
There was a problem hiding this comment.
Disclaimer: I haven't tested the PR yet, so everything I'm going to write here might not make sense because your implementation could be working as expected.
That said, here are just some initial thoughts regarding this component and suggestions:
1 - In the asset details flyout/full page, to prevent changes in the date picker from triggering requests in tabs that are not currently visible, we use the useIntersectingState hook. With this hook, you can delay component re-rendering to happen only once the component becomes visible.
2 - If Auto-Refresh is enabled, two things could happen: a never-ending loading loop and performance issues. If ongoing requests are not properly canceled between refresh cycles, the server will be busy with unnecessary requests.
To fix this, you could use the useRequestObservable() hook. This observable is responsible for determining when a new request can be made if auto-refresh is enabled. Here is an example of usage.
Feel free to reach out if you need any help, and sorry for the long comment :)
There was a problem hiding this comment.
Thank you @crespocarlos! Those are very good suggestions 🙌 Tbh I have not put much work into the FE component yet and was planning to do this with my next change while adding the Top Functions embeddable, at that point this component will become more complex and I'll have a better idea how to structure the code.
There was a problem hiding this comment.
hey @mykolaharmash , I've got some examples of what I said above.
Inventory UI: Auto refresh on (loading state and many cancelled requests)
auto_refresh_prof.mov
flamegraph request happen when the visible tab is the overview tab
hidden_prof_request.mov
For the auto-reload, it might be a good idea in the future if the profiler loader kept the rendered component and just showed a loading indicator above the content. Similar to the charts and table in the hosts view. I know this is not part of this ticket.
There was a problem hiding this comment.
Thank you for making the videos @crespocarlos! I'll add useIntersectingState and useRequestObservable as you suggested.
There was a problem hiding this comment.
@crespocarlos please take another look when have time. I've refactored a bit the request logic, the issues should be fixed now. I've used useRequestObservable to fix the canceled requests thingy, but for the unintended requests I went for a simple active flag based on the currently active tab (see here). It seemed like it's enough in this case, but let me know if I'm missing something.
There was a problem hiding this comment.
@crespocarlos, I've merged this one, but let me know if you see issues with the code, I'll address it with my next change 🙌
|
@elasticmachine merge upstream |
| <EuiFlexItem grow={false}> | ||
| <EuiLink onClick={() => createConnector()}> | ||
| <EuiLink | ||
| data-test-subj="serverlessSearchConnectorIngestionPanelSetUpAConnectorLink" |
There was a problem hiding this comment.
This seems to be some automated change, not related to the feature
sphilipse
left a comment
There was a problem hiding this comment.
Approving for CI auto-commit
cauemarcondes
left a comment
There was a problem hiding this comment.
did a first look, but haven't run it yet though.
| makeRequest(); | ||
| }, [makeRequest]); | ||
|
|
||
| if (loading || response === null) { |
There was a problem hiding this comment.
I think you can remove this if-clause, am I right? The Flamegraph component will render a loading spinner while loading = true.
There was a problem hiding this comment.
True, it was a quick patch to implicitly cast the response to the BaseFlameGraph and I forgot to get rid of it.
thomheymann
left a comment
There was a problem hiding this comment.
security changes LGTM
shahzad31
left a comment
There was a problem hiding this comment.
Obs UX MG Changes LGTM !!
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
cauemarcondes
left a comment
There was a problem hiding this comment.
LGTM, great work 🚀
Summary
This adds a new "Universal Profiling" tab to asset details with a flamegrapth for a selected host. The tab is behind a feature flag and is disabled by default. It will be enabled by default for clound/onprem once we implement Profiling empty state, serverless is tbd.
profilingEnabledfeature flagHow to test
kibana.yml