Skip to content

Conversation

@filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Dec 5, 2024

Description

Adds workspace instance metrics to track image sizes. This includes storing metrics in the database, exposing them through the workspace instance status, and making them available via the API's WorkspaceService.ListWorkspaceSessions endpoint.

Related Issue(s)

Fixes CLC-1016

How to test

https://ft-add-ws-3faf28c13f.preview.gitpod-dev.com/workspaces

Try this in your browser console after starting a workspace (fill in your org ID or join mine so you don't have to):

const response = await fetch("https://ft-add-ws-3faf28c13f.preview.gitpod-dev.com/public-api/gitpod.v1.WorkspaceService/ListWorkspaceSessions", {
    "credentials": "include",
    "headers": {
        "User-Agent": "connect-es/1.1.2",
        "Accept": "*/*",
        "content-type": "application/json",
        "Sec-Fetch-Dest": "empty",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Site": "same-origin",
        "Sec-GPC": "1",
    },
    "referrer": "https://ft-add-ws-3faf28c13f.preview.gitpod-dev.com/workspaces",
    "body": "{\"pagination\":{\"pageSize\":50},\"organizationId\":\"03a65446-6229-404d-b3ea-816b96533d85\"}",
    "method": "POST",
    "mode": "cors"
});
console.log(await response.json())

Under a workspace session in the response, you should see a metrics field.

@@ -1,4 +1,4 @@
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
// Copyright (c) 2024 Gitpod GmbH. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

@filiptronicek let's revert copyright changes (I thought it means copyright since? But I'm not sure why generated files need copyright)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer to keep the year changes, since otherwise we'll have to keep reverting them every time. I don't see it being too harmful.

Copy link
Contributor

@mustard-mh mustard-mh left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

image

*/
export interface WorkspaceInstanceMetrics {
image?: Partial<{
totalSize: number;
Copy link
Member

Choose a reason for hiding this comment

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

Comments would be 🥇

Copy link
Member Author

Choose a reason for hiding this comment

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

Added in b8de461 (#20426) 🙏

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested and works! ✔️

@roboquat roboquat merged commit 5bb738a into main Dec 9, 2024
19 checks passed
@roboquat roboquat deleted the ft/add-ws-image-stats-to-instances branch December 9, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants