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(manager): move and update metrics cards in the server view #2241

Merged
merged 33 commits into from
Jan 29, 2025

Conversation

daniellacosse
Copy link
Contributor

@daniellacosse daniellacosse commented Oct 14, 2024

Screenshot 2024-12-20 at 3 07 21 PM

@daniellacosse daniellacosse requested a review from sbruens October 16, 2024 18:07
@daniellacosse daniellacosse changed the title feat(manager): move and update metrics cards in the server view feat(manager): [MISSING ENDPOINT] move and update metrics cards in the server view Oct 16, 2024
@daniellacosse daniellacosse marked this pull request as ready for review October 16, 2024 18:08
@daniellacosse daniellacosse requested review from fortuna and a team as code owners October 16, 2024 18:08
@daniellacosse daniellacosse changed the title feat(manager): [MISSING ENDPOINT] move and update metrics cards in the server view feat(manager): [MISSING ENDPOINT - DO NOT MERGE] move and update metrics cards in the server view Oct 16, 2024
Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

This is very helpful to see how the API is used. I believe we will benefit a lot from merging the stats flows into one.

@daniellacosse daniellacosse force-pushed the daniellacosse/tunneltime/move_metrics branch from 55108a4 to ee8c388 Compare November 12, 2024 16:09
@github-actions github-actions bot added size/L and removed size/M labels Nov 12, 2024
Copy link
Contributor Author

@daniellacosse daniellacosse left a comment

Choose a reason for hiding this comment

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

Updated with the new endpoint JSON: will merge methods next

Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

As discussed offline, Per-ASN breakdown was a significant gap during the Iran crisis. It's a confirmed need and and we put a lot of effort to implement it. It's more of a question of how, not whether we want to surface that.

I would like to see that surfaced somehow in this PR, to inform the UX design. We've discussed a simple table, which seems to work well.

@daniellacosse
Copy link
Contributor Author

As discussed offline, Per-ASN breakdown was a significant gap during the Iran crisis. It's a confirmed need and and we put a lot of effort to implement it. It's more of a question of how, not whether we want to surface that.

I would like to see that surfaced somehow in this PR, to inform the UX design. We've discussed a simple table, which seems to work well.

Sure thing, working on it!

@daniellacosse
Copy link
Contributor Author

As discussed offline, Per-ASN breakdown was a significant gap during the Iran crisis. It's a confirmed need and and we put a lot of effort to implement it. It's more of a question of how, not whether we want to surface that.

I would like to see that surfaced somehow in this PR, to inform the UX design. We've discussed a simple table, which seems to work well.

Here's an initial PR for a data table component: #2273

@daniellacosse
Copy link
Contributor Author

@fortuna @sbruens ready for another look!

@daniellacosse daniellacosse requested a review from sbruens January 22, 2025 18:13
new Error('FakeServer.getServerMetrics not implemented')
);
}
getSupportedExperimentalEndpoints(): Promise<Set<string>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be private.

Copy link
Collaborator

Choose a reason for hiding this comment

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

And you can turn it into a boolean for the specific endpoint you are checking.

Copy link
Contributor Author

@daniellacosse daniellacosse Jan 28, 2025

Choose a reason for hiding this comment

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

making it private in the test classes messes up the inheritance in TS - but I made it private on shadowbox_server

@daniellacosse daniellacosse requested a review from fortuna January 28, 2025 19:14
@daniellacosse daniellacosse enabled auto-merge (squash) January 28, 2025 19:23
@daniellacosse daniellacosse removed the needs test Pull requests that require tests label Jan 29, 2025
@github-actions github-actions bot added size/XL and removed size/L labels Jan 29, 2025
@daniellacosse daniellacosse requested a review from fortuna January 29, 2025 20:29

try {
await this.api.request<MetricsJson>(
'experimental/server/metrics?since=30d'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sbruens HEAD gave 405 (Method Not Allowed) and OPTIONS returned a 404 - is there another HTTP Method I can use that the server supports?

Copy link
Collaborator

Choose a reason for hiding this comment

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

OPTIONS sounds like the perfect method for this!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I'm so used to most web servers having middleware that configure the right HEAD and OPTIONS by default. Agree OPTIONS is even more appropriate.

Copy link
Collaborator

@fortuna fortuna 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. The OPTIONS situation is unfortunate, that would be ideal. But I think we don't register an OPTIONS handler.


try {
await this.api.request<MetricsJson>(
'experimental/server/metrics?since=30d'
Copy link
Collaborator

Choose a reason for hiding this comment

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

OPTIONS sounds like the perfect method for this!


<style>
/*
TODO: currently webpack wants to relove the `url` link here but doesen't know how.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
TODO: currently webpack wants to relove the `url` link here but doesen't know how.
TODO: currently webpack wants to relove the `url` link here but doesn't know how.

@daniellacosse daniellacosse merged commit aee140a into master Jan 29, 2025
25 checks passed
@daniellacosse daniellacosse deleted the daniellacosse/tunneltime/move_metrics branch January 29, 2025 21:38

try {
await this.api.request<MetricsJson>(
'experimental/server/metrics?since=30d'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I'm so used to most web servers having middleware that configure the right HEAD and OPTIONS by default. Agree OPTIONS is even more appropriate.

@@ -1066,6 +1129,35 @@ export class ServerView extends DirMixin(PolymerElement) {
return formatting.formatBytesParts(totalBytes, language).value;
}

_formatHourUnits(hours: number, language: string) {
// This happens during app startup before we set the language
Copy link
Contributor

Choose a reason for hiding this comment

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

This is because we don't set a default value for the property in the Polymer property lifecycle. We should set it properly and then you should be able to remove this.

daniellacosse added a commit that referenced this pull request Feb 20, 2025
* feat(manager): move and update metrics cards in the server view

* getting close. trying to figure out this weird data model

* style update

* don't use reduce lol

* okay  it roughly works end to end

* add metrics messages

* access key tab

* update to use new "endpoint" - feedback next

* feedback

* endpoint implemented

* Update server_manager/www/app.ts

Co-authored-by: Vinicius Fortuna <[email protected]>

* Update server_manager/model/server.ts

Co-authored-by: Vinicius Fortuna <[email protected]>

* partial feedback

* feedback - needs test

* move implementatino

* fix

* fix unit formatting

* refactor for testing

* Update server_manager/www/shadowbox_server.ts

Co-authored-by: Sander Bruens <[email protected]>

* partial feedback

* simply method and remove from model

* make private

---------

Co-authored-by: Vinicius Fortuna <[email protected]>
Co-authored-by: Sander Bruens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants