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

Add metric highlights #5750

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open

Add metric highlights #5750

wants to merge 50 commits into from

Conversation

drewnoakes
Copy link
Member

@drewnoakes drewnoakes commented Sep 17, 2024

Description

For the last month, @adamint and I have been working on feature/dashpages. We're now preparing it for review for merge into main.

A dashpage is a composite metric view, displayed in the metrics page when data for the relevant instruments are available.

Here's an example dashpage, showing multiple instruments in separate tiled charts:

image

Currently dashpages are defined in a JSON file that ships with the dashboard. We include a default configuration.

Fixes #5289
Fixes #5295
Fixes #5303
Fixes #5298
Fixes #5287
Fixes #5347

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
      • Link to aspire-docs issue:
    • No, not initially.
Microsoft Reviewers: Open in CodeFlow

drewnoakes and others added 30 commits August 13, 2024 23:00
This will make it easier to add a block for rendering a dashpage.
* Populate dashpages from configuration

Fixes #5289

This change causes the dashboard to look for a file named `dashpages.json` in the current directory. If found, it's parsed to provide the set of dashpages shown on the metrics page.

* Test fixes

bunit doesn't support when `OnInitializedAsync` actually yields the thread, so provide bunit tests with a stub implementation of `IDashpagePersistence.GetDashpagesAsync` that returns an empty set synchronously. In future we may extend this type to allow test setup with dashpage definitions.
The list of available dashpages in the Metrics UI is dynamic, depending on the selected resource.

A dashpage will only be shown if:

- metrics are available for at least one chart, and
- all required metrics are available
- all required resources are available
# Conflicts:
#	src/Aspire.Dashboard/Components/Controls/Chart/ChartContainer.cs
#	src/Aspire.Dashboard/Components/Controls/Chart/PlotlyChart.razor
#	src/Aspire.Dashboard/Components/Controls/Chart/SingleMetricChartContainer.razor
#	src/Aspire.Dashboard/Components/Pages/Metrics.razor
#	src/Aspire.Dashboard/Components/Pages/Metrics.razor.cs
#	src/Aspire.Dashboard/Components/Pages/Metrics.razor.css
#	src/Aspire.Dashboard/Resources/Metrics.Designer.cs
#	src/Aspire.Dashboard/Resources/Metrics.resx
#	src/Aspire.Dashboard/wwwroot/js/app-metrics.js
#	src/Shared/StringComparers.cs
* fix merge, clean up

* save current dashpage

* beautify dashpages

* beautify chart filters in dashpages

* beautification

* fix bugs from merge

* improve table, chart appearance on mobile

* fix metric table height in dashpage, add dashpage header on mobile

* add fixedplacement to filter popover

* fix test

* continue to work on styling

* use unique ids for metric tables

* cleanup

* Fix broken tests

* Code formatting

* Avoid horizontal scrollbar in dashpage view

* Use integer for div id

This is consistent with other code that ensures unique IDs.

* Use correct string comparer

* Rename and doc property

---------

Co-authored-by: Drew Noakes <[email protected]>
… necessary for popovers within a card to display correctly. Sets fixedplacement in chart filter popup to allow breaking out of parent popup
@adamint
Copy link
Member

adamint commented Sep 30, 2024

Opening the attribute popup inside the filter popup doesn't work:

Fixed.
image

I expected the filters popup to be closable by clicking anyway on the page outside of the popup. This is how popups work everywhere else in Aspire (and web pages in general). However, only clicking in the panel will close the popup:

I think this due to how cards work, and thus can't be changed without adding a document click listener. Is this a correct assumption @vnbaaij?

@adamint
Copy link
Member

adamint commented Sep 30, 2024

http.client.request.duration has frozen. Closing and opening the filter popup causes values to update. I'm guessing an error was thrown and the timer that regularly updates data and renders stopped working. Closing and opening the filter causes a render and so data updates once.

I was unable to reproduce this issue. Do you have repro steps?

…ince this component will be initialized on each popup open
@adamint
Copy link
Member

adamint commented Sep 30, 2024

Add a spacer between view dropdown and duration dropdown:

Done.
image

Some other state is preserved when switching between views. "Show count" stays enable.

I was able to reproduce this, now show count works properly inside the card.

Adam Ratzman added 4 commits September 30, 2024 14:43
- apply correct classes
- only use aspect-ratio and max-width on single metric view
- change the resize observer to watch the chart container itself. It was resizing to 100% because its *parent* takes up 100% of the width
@adamint
Copy link
Member

adamint commented Sep 30, 2024

I think there has been a regression on standalone metrics pages. The graph extends to fill the entire page. I believe it use to have a max width:

This has now been fixed. The new resize observer was resizing the plot to be larger than the maximum width we had set.
image

@JamesNK
Copy link
Member

JamesNK commented Sep 30, 2024

Currently, there is no internal identifier for views. That display name is also unique

Please add one. Even if titles are unique now, this is going in the URL so there is the chance that people will bookmark it. Changing it to not use the title will break URLs.

It doesn't seem like a difficult change and it helps avoid the URL changing in the future.

@JamesNK
Copy link
Member

JamesNK commented Sep 30, 2024

I think this due to how cards work, and thus can't be changed without adding a document click listener. Is this a correct assumption @vnbaaij?

What are you using cards for that is special? If cards are a problem, why not use a regular div and apply the same styling?

@JamesNK
Copy link
Member

JamesNK commented Sep 30, 2024

I was unable to reproduce this issue. Do you have repro steps?

No. It looks like a thread safety problem: collection being modified at the same time as it is being enumerated

@vnbaaij
Copy link
Contributor

vnbaaij commented Oct 1, 2024

I think this due to how cards work, and thus can't be changed without adding a document click listener. Is this a correct assumption @vnbaaij?

What are you using cards for that is special? If cards are a problem, why not use a regular div and apply the same styling?

I generally don't use cards for a popup. For DataGrid resize popup we indeed just use a div with some script to detect clicking outside.

@adamint
Copy link
Member

adamint commented Oct 1, 2024

Multiple popups can be opened at the same time (would be fixed by fixing the issue above, because clicking outside of the popup would close it). Also, switching between views leaves the popup open (also would be fixed by the above):

This no longer seems like it's occurring

@adamint
Copy link
Member

adamint commented Oct 1, 2024

Currently, there is no internal identifier for views. That display name is also unique

Please add one. Even if titles are unique now, this is going in the URL so there is the chance that people will bookmark it. Changing it to not use the title will break URLs.

It doesn't seem like a difficult change and it helps avoid the URL changing in the future.

Added

@adamint
Copy link
Member

adamint commented Oct 1, 2024

I was unable to reproduce this issue. Do you have repro steps?

No. It looks like a thread safety problem: collection being modified at the same time as it is being enumerated

I changed the collection to a ConcurrentBag, so this shouldn't occur again.

@drewnoakes drewnoakes changed the title Add Dashpages Add metric highlights Oct 2, 2024
adamint and others added 3 commits October 2, 2024 13:24
# Conflicts:
#	src/Aspire.Dashboard/Components/Controls/Chart/ChartContainer.cs
#	src/Aspire.Dashboard/Components/Controls/Chart/ChartFilters.razor
#	src/Aspire.Dashboard/Components/Pages/Metrics.razor.cs
@radical
Copy link
Member

radical commented Oct 3, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

* Separate dashpage id and display name

* sort dashpages consistently

* Change dashpages -> highlights

* Update dashpage query parameter to highlight, /dashpages -> /highlights

* update page directive

* change InstrumentViewModel.DataUpdateSubscriptions to prevent enumeration during collection modification, which can happen asynchronously

* Remove extra parameters after merge

* fix test

* update test expectation, remove comparer

* change dashpage -> highlight

* add warning comment

* put highlight id in path

---------

Co-authored-by: Adam Ratzman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants