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

ui: fix timescale for rolling window #106623

Merged
merged 1 commit into from
Jul 13, 2023
Merged

Conversation

maryliag
Copy link
Contributor

@maryliag maryliag commented Jul 11, 2023

The change introduced on #105157 had an undesired
change on the Metrics page. We want to show the end period
of the select, but when the fixed window end for that this
caused the Metrics page to stop loading new data.
We want the metrics page to keep updating when any of the
rolling windows is selected, and we also want to know
the time a time period was requested, so it can be used
to provide more information on SQL Activity pages.

This commit remove the setting of the fixedWindowEnd, since
that was not the best approach and instead creates a value
on local storage for the requestTime, that can be used to create
the label for the timescale, without interferring on
Metrics page (or any other that have an automatic update).

Epic: none

Release note (bug fix): Fix the Metrics page that was not
updating automatically on rolling window options.

Release note (bug fix): Statement Diagnostics not always
showing is now fixed and they show for the correct time period selected.

@maryliag maryliag added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jul 11, 2023
@maryliag maryliag requested review from koorosh and a team July 11, 2023 20:14
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@koorosh koorosh left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)

a discussion (no related file):
Should requestTime be a part of timeScale at all?
My assumption that:

  • it is a part of SQL Activity redux state where we can track the time last request/response was made and have dedicated selector to show this value on UI.
  • timeScale is aware about selected options and overloading it with custom cases like this might lead to more regressions. IMO TimeScale and date picker is very fragile for any changes

Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh)

a discussion (no related file):

Previously, koorosh (Andrii Vorobiov) wrote…

Should requestTime be a part of timeScale at all?
My assumption that:

  • it is a part of SQL Activity redux state where we can track the time last request/response was made and have dedicated selector to show this value on UI.
  • timeScale is aware about selected options and overloading it with custom cases like this might lead to more regressions. IMO TimeScale and date picker is very fragile for any changes

My idea was that this parameter was saving the time you changed the option, and this can be used in more pages then just SQL Activity, also Insights, Index Details, and so on, so is the responsibility of the component using the timescale to decide if that value is required or not and what it should be. But the component itself is just preparing to receive and do the proper label formatting for this case.
This way this value doesn't affect at all the behaviour of the component, is just about having a label, but at the same time is uniform against all usage.


Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh)

a discussion (no related file):

Previously, maryliag (Marylia Gutierrez) wrote…

My idea was that this parameter was saving the time you changed the option, and this can be used in more pages then just SQL Activity, also Insights, Index Details, and so on, so is the responsibility of the component using the timescale to decide if that value is required or not and what it should be. But the component itself is just preparing to receive and do the proper label formatting for this case.
This way this value doesn't affect at all the behaviour of the component, is just about having a label, but at the same time is uniform against all usage.

I can update the name if there is something more appropriate, such as "selectionTime", since that is what it means anyway.


Copy link
Collaborator

@koorosh koorosh left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)

a discussion (no related file):

Previously, maryliag (Marylia Gutierrez) wrote…

I can update the name if there is something more appropriate, such as "selectionTime", since that is what it means anyway.

It is stored in src/redux/timeScale.ts as a single value so it cannot be reused in multiple places.
When requestTime is set on SQL Activity page, it will be updated on other pages as well because timeScale is a global thing.


Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh)

a discussion (no related file):

Previously, koorosh (Andrii Vorobiov) wrote…

It is stored in src/redux/timeScale.ts as a single value so it cannot be reused in multiple places.
When requestTime is set on SQL Activity page, it will be updated on other pages as well because timeScale is a global thing.

By reuse I just meant the feature itself, not the we would have several values. Sorry about the confusion.
Seems like that solution was causing more confusion, so I switched to store the value on local storage instead.
PTAL


Copy link
Collaborator

@koorosh koorosh left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @maryliag)

a discussion (no related file):

Previously, maryliag (Marylia Gutierrez) wrote…

By reuse I just meant the feature itself, not the we would have several values. Sorry about the confusion.
Seems like that solution was causing more confusion, so I switched to store the value on local storage instead.
PTAL

I thought timeScale should already have correct end value for non-custom options (ie it is set to current time)? If it's true then it can be used directly?
Maybe I'm missing something important in current logic of date range selector, need to learn how it works rn.


Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh)

a discussion (no related file):

Previously, koorosh (Andrii Vorobiov) wrote…

I thought timeScale should already have correct end value for non-custom options (ie it is set to current time)? If it's true then it can be used directly?
Maybe I'm missing something important in current logic of date range selector, need to learn how it works rn.

For non-custom, the end value was always null, which allow rolling window to keep going (Past 1h keep getting the end updated to "now").
What I have done previously was setting up a value for the end value even for those cases, since we pause the requests on SQL Activity page. The problem was that this also made the rolling window pause on the Metrics page, and we don't want that. So my attempt to reuse the end parameter was not correct, so I had to move away from it.
I tried to keep using something still inside TimeScale but seems to be causing more confusion, so I used something separate, and should be good now!


Copy link

@THardy98 THardy98 left a comment

Choose a reason for hiding this comment

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

Reviewed 15 of 28 files at r3, 4 of 4 files at r4, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @maryliag)

a discussion (no related file):

Previously, maryliag (Marylia Gutierrez) wrote…

For non-custom, the end value was always null, which allow rolling window to keep going (Past 1h keep getting the end updated to "now").
What I have done previously was setting up a value for the end value even for those cases, since we pause the requests on SQL Activity page. The problem was that this also made the rolling window pause on the Metrics page, and we don't want that. So my attempt to reuse the end parameter was not correct, so I had to move away from it.
I tried to keep using something still inside TimeScale but seems to be causing more confusion, so I used something separate, and should be good now!

Generally, I think I like the idea of separating the request time from the timescale. Why is it that we want different request times for statements/transactions pages? I thought the idea more generally was to keep the same time window for both ?


Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @THardy98)

a discussion (no related file):

Previously, THardy98 (Thomas Hardy) wrote…

Generally, I think I like the idea of separating the request time from the timescale. Why is it that we want different request times for statements/transactions pages? I thought the idea more generally was to keep the same time window for both ?

The requests don't always align, if you refresh Transaction not necessarily updates the Statement, so I want to make it clear the values for each one.
To clarify this PR doesn't change anything about when/how the requests are made. Is only storing when they were made so we can then surface on the UI.


Copy link

@THardy98 THardy98 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @maryliag)

a discussion (no related file):

Previously, maryliag (Marylia Gutierrez) wrote…

The requests don't always align, if you refresh Transaction not necessarily updates the Statement, so I want to make it clear the values for each one.
To clarify this PR doesn't change anything about when/how the requests are made. Is only storing when they were made so we can then surface on the UI.

Ah ok. So for these pages, the timescale is moreso acting as a starting time, and the end time is the request time (in the default, non-custom case).


Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @THardy98)

a discussion (no related file):

Previously, THardy98 (Thomas Hardy) wrote…

Ah ok. So for these pages, the timescale is moreso acting as a starting time, and the end time is the request time (in the default, non-custom case).

Yes, that's correct (since we stopped auto refreshing those pages)


Copy link

@THardy98 THardy98 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @koorosh and @maryliag)

a discussion (no related file):

Previously, maryliag (Marylia Gutierrez) wrote…

Yes, that's correct (since we stopped auto refreshing those pages)

Cool, then :lgtm: to me!
Thanks for the fix!


The change introduced on cockroachdb#105157 had an undesired
change on the Metrics page. We want to show the end period
of the select, but when the fixed window end for that this
caused the Metrics page to stop loading new data.
We want the metrics page to keep updating when any of the
rolling windows is selected, and we also want to know
the time a time period was requested, so it can be used
to provide more information on SQL Activity pages.

This commit remove the setting of the fixedWindowEnd, since
that was not the best approach and instead creates a value
on local storage for the requestTime, that can be used to create
the label for the timescale, without interferring on
Metrics page (or any other that have an automatic update).

Epic: none

Release note (bug fix): Fix the Metrics page that was not
updating automatically on rolling window options.
@maryliag
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 13, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jul 13, 2023

Build succeeded:

@craig craig bot merged commit b3c64ee into cockroachdb:master Jul 13, 2023
@blathers-crl
Copy link

blathers-crl bot commented Jul 13, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 51f5a93 to blathers/backport-release-23.1-106623: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@theodore-hyman
Copy link
Contributor

Hello, I have a customer that is still facing this UI issue and it is getting to the point where its impacting their ability to further develop their app and troubleshoot issues as they arise, if this drags on much longer its going to impact the production timeline and the overall customer confidence, reqeusting a follow up on when this UI issue will get fixed, thank you

@maryliag @THardy98 CC @brenda-crl

@theodore-hyman
Copy link
Contributor

theodore-hyman commented Jul 28, 2023

Not seeing that this github issue is linked to the Zendesk ticket so dropping this link here to the ticket in case it is helpful: https://cockroachdb.zendesk.com/agent/tickets/18003

Seems this pull request has been merged but the issue is still happening ... unclear what's happening .. maybe this is already fixed but the serverless cluster they're running is not on the proper version yet? .. .. thank you

CC @world2mark

@maryliag
Copy link
Contributor Author

This fix is not yet on Serverless cluster, make take a few more days to get there. I can update the ticket once is available there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants