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(webapp): Issue when comparison / diff timelines are out of range #1615

Merged
merged 20 commits into from
Nov 1, 2022

Conversation

pavelpashkovsky
Copy link
Contributor

@pavelpashkovsky pavelpashkovsky commented Oct 14, 2022

Brief

Changes

@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Base: 66.10% // Head: 66.52% // Increases project coverage by +0.43% 🎉

Coverage data is based on head (d2dac57) compared to base (e04a9a5).
Patch coverage: 86.37% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1615      +/-   ##
==========================================
+ Coverage   66.10%   66.52%   +0.43%     
==========================================
  Files         146      152       +6     
  Lines        4987     5113     +126     
  Branches     1144     1179      +35     
==========================================
+ Hits         3296     3401     +105     
- Misses       1685     1706      +21     
  Partials        6        6              
Impacted Files Coverage Δ
...pp/javascript/components/TimelineChart/markings.ts 95.46% <ø> (ø)
webapp/javascript/ui/Button.module.scss 61.54% <ø> (ø)
webapp/javascript/ui/Button.tsx 78.38% <0.00%> (+1.24%) ⬆️
webapp/javascript/ui/StatusMessage/index.tsx 65.00% <55.56%> (ø)
...ascript/ui/StatusMessage/StatusMessage.module.scss 61.54% <61.54%> (ø)
...ipt/components/TimelineChart/centerTimelineData.ts 87.50% <87.50%> (ø)
.../components/TimelineChart/SyncTimelines/useSync.ts 95.84% <95.84%> (ø)
...t/components/TimelineChart/SyncTimelines/index.tsx 100.00% <100.00%> (ø)
...nts/TimelineChart/SyncTimelines/styles.module.scss 61.54% <100.00%> (ø)
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2022

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
webapp/public/assets/app.js 483.06 KB (+0.16% 🔺) 9.7 s (+0.16% 🔺) 3.1 s (-27.86% 🔽) 12.8 s
webapp/public/assets/app.css 18.19 KB (+1.04% 🔺) 364 ms (+1.04% 🔺) 0 ms (+100% 🔺) 364 ms
webapp/public/assets/styles.css 9.52 KB (0%) 191 ms (0%) 0 ms (+100% 🔺) 191 ms
packages/pyroscope-flamegraph/dist/index.js 128.37 KB (+0.03% 🔺) 2.6 s (+0.03% 🔺) 1.6 s (+12.14% 🔺) 4.2 s
packages/pyroscope-flamegraph/dist/index.node.js 128.79 KB (+0.03% 🔺) 2.6 s (+0.03% 🔺) 721 ms (-11.43% 🔽) 3.3 s
packages/pyroscope-flamegraph/dist/index.css 7.55 KB (+0.68% 🔺) 151 ms (+0.68% 🔺) 0 ms (+100% 🔺) 151 ms

@eh-am
Copy link
Collaborator

eh-am commented Oct 14, 2022

I think we can solve this at a different level.

Given https://demo-dev.pyroscope.io/comparison?query=rideshare-app-golang.alloc_objects%7B%7D&rightQuery=rideshare-app-golang.alloc_objects%7B%7D&leftQuery=rideshare-app-golang.alloc_objects%7B%7D&from=1665749249&until=1665749701

if the interval leftFrom and leftUntil is outside the [from, until] range, display a notification, maybe on top of the timeline? We have an errorMessage ocmponent somewhere, I think it could be something like that, which is similar to bootstrap's alert: https://getbootstrap.com/docs/4.0/components/alerts/
image

@pavelpashkovsky
Copy link
Contributor Author

@eh-am I think your variant is really good, interesting what @Rperry2174 thinks about it. and what is possible appearance and position of this alert?

@pavelpashkovsky pavelpashkovsky force-pushed the track-selection-out-of-range branch from 0f6c08d to 795a064 Compare October 17, 2022 11:59
@pavelpashkovsky
Copy link
Contributor Author

/create-server

@pavelpashkovsky
Copy link
Contributor Author

I can add tests after your review

@Ivanikitin Ivanikitin added the frontend Mostly JS code label Oct 18, 2022
@Rperry2174
Copy link
Contributor

Rperry2174 commented Oct 18, 2022

Lets do the following:

  1. Move the notification to below the main timeline
  2. When clicking the button it should extend the main timeline to include the entire blue range and also the entire pink range

The logic behind 2 is that this issue most frequently occurs when the main timeline is dynamic, but the comparison sub-timeline's are fixed and so we should adjust the main timeline to fit those

@pavelpashkovsky pavelpashkovsky force-pushed the track-selection-out-of-range branch from 94adaa2 to e4e60b1 Compare October 20, 2022 11:49
@pavelpashkovsky
Copy link
Contributor Author

/create-server

@pavelpashkovsky
Copy link
Contributor Author

/create-server

@pavelpashkovsky
Copy link
Contributor Author

hey guys, demo shows previous commit version. caching issue?

@Rperry2174
Copy link
Contributor

Looking at the commit I think its the correct version... what makes you think its the wrong version?

@Rperry2174
Copy link
Contributor

Rperry2174 commented Oct 21, 2022

Looks great a couple of tweaks here:

  • Let's add an "ignore" button which makes the alert disappear

For the colors lets do (and let's make sure these are variables as well):

  • background: #f2cd51
  • text: --ps-immutable-placeholder-text
  • border: --ps-ui-border

image

For the text let's change it to be a little more specific:

  • "Warning: Baseline timeline selection is out of range"
  • "Warning: Comparison timeline selection is out of range"
  • "Warning: Baseline and comparison timeline selections are out of range"

@pavelpashkovsky
Copy link
Contributor Author

/create-server

@Rperry2174
Copy link
Contributor

Rperry2174 commented Oct 21, 2022

There's currently an issue where when you select a time range after the default time ranges load, you get the error message because the pink timerange is almost immediately "out of range".

In order to prevent this, let's change the logic so that there is a "buffer" of 5 minutes on the "minumum" side. For example:

Should not show a warning message:
Baseline (pink) timerange: 00:56 to 1:30
Comparison (blue) timerange: 1:30 to 2:00
Main timerange: 1:00 to 2:00

baseline min (00:56) to main min (1:00) is 4 minutes which is < 5 minute buffer so do not show a warning message

Should show a warning message:
Baseline (pink) timerange: 00:54 to 1:30
Comparison (blue) timerange: 1:30 to 2:00
Main timerange: 1:00 to 2:00

baseline min (00:54) to main min (1:30) is 6 minutes whic is > 5 minute buffer so do show a warning message

Let's for now put this "buffer" in a variable and we may adjust this buffer later, but it should fix the problem for now.

@pavelpashkovsky
Copy link
Contributor Author

/create-server

@pavelpashkovsky pavelpashkovsky changed the title feat(webapp): Issue when comparison / diff timelines are out of range [WIP] feat(webapp): Issue when comparison / diff timelines are out of range Oct 24, 2022
@pavelpashkovsky pavelpashkovsky marked this pull request as ready for review October 24, 2022 14:18
Copy link
Collaborator

@eh-am eh-am left a comment

Choose a reason for hiding this comment

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

Looks good! I have few thoughts though:

RE: reusability

  1. There's already a StatusMessage component, which I think can be reused here.

https://github.com/pyroscope-io/pyroscope/blob/main/webapp/javascript/ui/StatusMessage/index.tsx

  1. Instead of creating custom buttons, we should reuse the existing button we have, and if necessary extend it in such a way that's reusable.

RE: organization

Right now it works for comparison/diff since both use left/right, but not necessarily. Let's decouple input/output, plus it becomes testable.

The API would be something like

<SyncTimelines onSync={onSync} main={mainTimeline} left={leftTimeline} right={rightTimeline} />

Since code will be pretty similar between comparison/diff, then you can add another interaction layer to reuse the same logic if that helps. But biggest point is that the syncTimelines functionality should NOT be aware of the store/anything else. It just takes inputs and calls outputs.

Tests

Given my previous point, it will be easy to test this component. And it makes it as good documentation.

@pavelpashkovsky
Copy link
Contributor Author

@eh-am

RE: organization

I updated API in this way, now this component doesn't have any connection to redux store

RE: reusability

I use StatusMessage , but initial UI design of this component differs from what we need for this warning. StatusMessage API allows styling it in way we need, but I did nothing with error and success appearance, what looks a bit weird from my perspective. Can you please take a look at this component and way of using it, maybe you have some better solution

image

@pavelpashkovsky
Copy link
Contributor Author

/create-server

@pavelpashkovsky
Copy link
Contributor Author

image

@pavelpashkovsky
Copy link
Contributor Author

/create-server

@Rperry2174
Copy link
Contributor

/create-server

Comment on lines 46 to 59
const [
{
xaxis: { from: leftMarkingsFrom, to: leftMarkingsTo },
},
] = markingsFromSelection('single', {
...leftSelection,
} as Selection);
const [
{
xaxis: { from: rightMarkingsFrom, to: rightMarkingsTo },
},
] = markingsFromSelection('single', {
...rightSelection,
} as Selection);
Copy link
Collaborator

Choose a reason for hiding this comment

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

My understanding is that you are using this to convert an arbitrary from/to to a timestamp right? If so you can use https://github.com/pyroscope-io/pyroscope/blob/569091ed1a27cbe86611420b4fdf3bcdf3b330d6/webapp/javascript/util/formatDate.ts#L70-L89
not the best name i know

I am saying this bc markingsFromSelection is all about markings, those vertical lines in the timeline:
image.
Point is that that markingsFromSelection function is purely visual. Since you don't need that aspect, you can use formatAsOBject directly.

Copy link
Member

@petethepig petethepig left a comment

Choose a reason for hiding this comment

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

Haven't looked at the code but the demo looks great!

@pavelpashkovsky
Copy link
Contributor Author

/create-server

@Rperry2174 Rperry2174 merged commit 211ccca into main Nov 1, 2022
@Rperry2174 Rperry2174 deleted the track-selection-out-of-range branch November 1, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Mostly JS code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants