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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

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.

server_manager/index.html Outdated Show resolved Hide resolved
server_manager/messages/master_messages.json Show resolved Hide resolved
server_manager/messages/master_messages.json Show resolved Hide resolved
server_manager/model/server.ts Outdated Show resolved Hide resolved
server_manager/www/app.ts Outdated Show resolved Hide resolved
server_manager/www/app.ts Outdated Show resolved Hide resolved
@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

server_manager/messages/master_messages.json Show resolved Hide resolved
server_manager/messages/master_messages.json Show resolved Hide resolved
server_manager/www/app.ts Outdated Show resolved Hide resolved
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 daniellacosse changed the title feat(manager): [MISSING ENDPOINT - DO NOT MERGE] move and update metrics cards in the server view feat(manager): move and update metrics cards in the server view Nov 21, 2024
@daniellacosse daniellacosse requested a review from fortuna December 4, 2024 19:04
server_manager/index.html Outdated Show resolved Hide resolved
server_manager/model/server.ts Outdated Show resolved Hide resolved
server_manager/www/testing/models.ts Outdated Show resolved Hide resolved
server_manager/www/app.ts Outdated Show resolved Hide resolved
server_manager/www/shadowbox_server.ts Outdated Show resolved Hide resolved
server_manager/messages/master_messages.json Show resolved Hide resolved
server_manager/messages/master_messages.json Show resolved Hide resolved
server_manager/index.html Outdated Show resolved Hide resolved
server_manager/www/ui_components/outline-server-view.ts Outdated Show resolved Hide resolved
server_manager/www/app.ts Outdated Show resolved Hide resolved
server_manager/www/shadowbox_server.ts Outdated Show resolved Hide resolved
server_manager/www/testing/models.ts Outdated Show resolved Hide resolved
@daniellacosse daniellacosse added the needs test Pull requests that require tests label Dec 17, 2024
@daniellacosse
Copy link
Contributor Author

daniellacosse commented Dec 20, 2024

After testing with the new canary server, this is basically working, except the fact that the data flow in our UI is bad and not triggering a render as it should. (to get it to show up in the UI in the above screenshot I had to edit the code to trigger a live reload LMAO) We should be passing data through HTML attributes not via JS properties...

Anyway, I'll return after the holidays to fix that, format the hourly units properly, and add a unit test.

@daniellacosse
Copy link
Contributor Author

@fortuna @sbruens ready for another look!

server_manager/www/shadowbox_server.ts Show resolved Hide resolved
server_manager/www/shadowbox_server.ts Outdated Show resolved Hide resolved
(await this.getSupportedExperimentalEndpoints()).has('server/metrics')
) {
return this.api.request<server.ServerMetricsJson>(
'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.

I find the discrepancy between the checked URL (server/metrics) and the used URL (experimental/server/metrics) unnecessary. Why not just keep the experimental/ prefix in both to avoid mapping on both sides?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only reason why I didn't is because i thought it might be redundant with the name of the method. And that we shouldn't call the method getSupportedEndpoints because I would expect that to return ALL the endpoints. @fortuna thoughts?

}

getName(): string {
return this.serverConfig?.name;
}

async getSupportedExperimentalEndpoints(): Promise<Set<string>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly, I find the use of this separate check and set unnecessarily complicated. Soon the new metrics server URLs will be non-experimental and this code will be dead or need reworking. Will this actually be reused?

Copy link
Contributor Author

@daniellacosse daniellacosse Jan 22, 2025

Choose a reason for hiding this comment

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

I don't have a strong opinion here. I am attempting to anticipate what @fortuna wants. It became clear that to test this I would need to add a property regarding the experimental endpoints to the root server model and noticed there were only set/get methods there for some reason.

Worth noting there is currently one other experimental endpoint on the server, "access-key-data-limit": https://github.com/Jigsaw-Code/outline-server/blob/13f62390bfda8cd0ac9215aad685ae82f82a1270/src/shadowbox/server/api.yml#L518

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah agreed, though that endpoint is just a redirect. I wonder if we can just remove it from api.yaml instead of marking it as deprecated? I'm not sure what the best practice is on that.

I would kind of prefer an inline "try and fallback if 404" from a readability perspective, but hesitate to recommend it because it adds unnecessary requests for a while for users on old versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would kind of prefer an inline "try and fallback if 404" from a readability perspective, but hesitate to recommend it because it adds unnecessary requests for a while for users on old versions.

Yeah, that is what I had initially before the point about unnecessary requests was raised.

@daniellacosse daniellacosse requested a review from sbruens January 22, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs test Pull requests that require tests size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants