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

fix: prevent multiple calls to time-series on compare view select #9805

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

ashtonG
Copy link
Contributor

@ashtonG ashtonG commented Aug 7, 2024

Ticket

ET-677

Description

This fixes an issue where the page could appear slower than it should on load due to too much blocking traffic. We make three requests to build the comparison view for runs, searches and experiments:

  1. request to get search/run information of selected runs/search ids

  2. request to get metric names from selected runs/searches

  3. request to get timeseries data given selected run ids and metric names.

we were attempting to make these requests simultaneously when the each request is dependent on information in the previous request. We also used usePrevious hooks as dependencies of useCallback hooks, which meant that we would erroneously update the callback reference when the previous value update was picked up on subsequent renders.

this pr fixes these issues by not rendering the comparison view tabs until the request for the records in the selection has completed, then not loading the time series data until the metric names request has started to return information. We also clean up some places where effects were called due to usePrevious and the overall data flow which should prevent issues with out of date data appearing.

Test Plan

  • Visit the runs page with the developer tools open to the network tab
  • ensure some runs are selected
  • when opening the comparison view, there should be one request made to metric-names and one request made to time-series
  • when updating the selection, there should be one request made to metric-names and one request made to time-series. the comparison view should briefly show the loading state before showing the full data state.

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

This fixes an issue where the page could appear slower than it should on
load due to too much blocking traffic. We make three requests to build
the comparison view for runs, searches and experiments:

1) request to get search/run information of selected runs/search ids

2) request to get metric names from selected runs/searches

3) request to get timeseries data given selected run ids and metric names.

we were attempting to make these requests simultaneously when the
each request is dependent on information in the previous request.
We also used `usePrevious` hooks as dependencies of `useCallback` hooks,
which meant that we would erroneously update the callback reference when
the previous value update was picked up on subsequent renders.

this pr fixes these issues by not rendering the comparison view tabs
until the request for the records in the selection has completed, then
not loading the time series data until the metric names request has
started to return information. We also clean up some places where
effects were called due to usePrevious and the overall data flow which
should prevent issues with out of date data appearing.
@ashtonG ashtonG requested a review from a team as a code owner August 7, 2024 18:30
@cla-bot cla-bot bot added the cla-signed label Aug 7, 2024
Copy link

netlify bot commented Aug 7, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit af467b8
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/66b3bd643a77bc000857d324
😎 Deploy Preview https://deploy-preview-9805--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 22.83951% with 125 lines in your changes missing coverage. Please review.

Project coverage is 50.01%. Comparing base (db98c4f) to head (af467b8).

Files Patch % Lines
webui/react/src/components/ComparisonView.tsx 18.88% 73 Missing ⚠️
webui/react/src/hooks/useMetrics.ts 9.09% 50 Missing ⚠️
webui/react/src/components/CompareMetrics.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9805      +/-   ##
==========================================
- Coverage   54.31%   50.01%   -4.31%     
==========================================
  Files        1261      938     -323     
  Lines      155639   126309   -29330     
  Branches     3540     3536       -4     
==========================================
- Hits        84536    63171   -21365     
+ Misses      70965    63000    -7965     
  Partials      138      138              
Flag Coverage Δ
harness ?
web 53.71% <22.83%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...rc/components/CompareHyperparameters.test.mock.tsx 100.00% <ø> (ø)
.../react/src/components/ComparisonView.test.mock.tsx 99.31% <ø> (-0.04%) ⬇️
webui/react/src/hooks/useMetricNames.ts 53.26% <100.00%> (+2.68%) ⬆️
webui/react/src/components/CompareMetrics.tsx 15.06% <0.00%> (-0.15%) ⬇️
webui/react/src/hooks/useMetrics.ts 19.31% <9.09%> (+0.03%) ⬆️
webui/react/src/components/ComparisonView.tsx 67.72% <18.88%> (-24.02%) ⬇️

... and 323 files with indirect coverage changes

Copy link
Contributor

@keita-determined keita-determined left a comment

Choose a reason for hiding this comment

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

LGTM for the frontend improvement, but i think we need API improvement as well.
cc: @jesse-amano-hpe @AmanuelAaron

Screen.Recording.2024-08-07.at.11.45.53.AM.mov

@ashtonG ashtonG added the to-cherry-pick Pull requests that need to be cherry-picked into the current release label Aug 7, 2024
@ashtonG ashtonG merged commit f7e18fc into main Aug 7, 2024
91 of 104 checks passed
@ashtonG ashtonG deleted the bug/ET-677/time-series-fix branch August 7, 2024 19:40
github-actions bot pushed a commit that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed to-cherry-pick Pull requests that need to be cherry-picked into the current release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants