-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add WS image metrics to workspace instances #20426
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
82fea2b
Add WS image metrics to workspace instances
filiptronicek ad95ee6
Update tests
filiptronicek 5a694a3
fix ws-manager-api field description
filiptronicek f4f7a27
Prefer existing DB values for metrics
filiptronicek b8de461
Copy proto comments over to protocol type
filiptronicek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
components/gitpod-db/src/typeorm/migration/1733397172273-AddWorkspaceInstanceMetrics.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * Copyright (c) 2024 Gitpod GmbH. All rights reserved. | ||
| * Licensed under the GNU Affero General Public License (AGPL). | ||
| * See License.AGPL.txt in the project root for license information. | ||
| */ | ||
|
|
||
| import { MigrationInterface, QueryRunner } from "typeorm"; | ||
| import { columnExists } from "./helper/helper"; | ||
|
|
||
| const table = "d_b_workspace_instance"; | ||
| const newColumn = "metrics"; | ||
|
|
||
| export class AddWorkspaceInstanceMetrics1733397172273 implements MigrationInterface { | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| if (!(await columnExists(queryRunner, table, newColumn))) { | ||
| await queryRunner.query(`ALTER TABLE ${table} ADD COLUMN ${newColumn} JSON NULL`); | ||
| } | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| if (await columnExists(queryRunner, table, newColumn)) { | ||
| await queryRunner.query(`ALTER TABLE ${table} DROP COLUMN ${newColumn}`); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,7 +75,7 @@ export interface WorkspaceInstance { | |
| // WorkspaceInstanceStatus describes the current state of a workspace instance | ||
| export interface WorkspaceInstanceStatus { | ||
| // version is the current version of the workspace instance status | ||
| // Note: consider this value opague. The only guarantee given is that it imposes | ||
| // Note: consider this value opaque. The only guarantee given is that it imposes | ||
| // a partial order on status updates, i.e. a.version > b.version -> a newer than b. | ||
| version?: number; | ||
|
|
||
|
|
@@ -105,6 +105,9 @@ export interface WorkspaceInstanceStatus { | |
|
|
||
| // ownerToken is the token one needs to access the workspace. Its presence is checked by ws-proxy. | ||
| ownerToken?: string; | ||
|
|
||
| // metrics contains metrics about the workspace instance | ||
| metrics?: WorkspaceInstanceMetrics; | ||
| } | ||
|
|
||
| // WorkspaceInstancePhase describes a high-level state of a workspace instance | ||
|
|
@@ -122,11 +125,11 @@ export type WorkspaceInstancePhase = | |
| | "building" | ||
|
|
||
| // Pending means the workspace does not yet consume resources in the cluster, but rather is looking for | ||
| // some space within the cluster. If for example the cluster needs to scale up to accomodate the | ||
| // some space within the cluster. If for example the cluster needs to scale up to accommodate the | ||
| // workspace, the workspace will be in Pending state until that happened. | ||
| | "pending" | ||
|
|
||
| // Creating means the workspace is currently being created. Thati includes downloading the images required | ||
| // Creating means the workspace is currently being created. That includes downloading the images required | ||
| // to run the workspace over the network. The time spent in this phase varies widely and depends on the current | ||
| // network speed, image size and cache states. | ||
| | "creating" | ||
|
|
@@ -193,7 +196,7 @@ export interface WorkspaceInstancePort { | |
| // The outward-facing port number | ||
| port: number; | ||
|
|
||
| // The visiblity of this port. Optional for backwards compatibility. | ||
| // The visibility of this port. Optional for backwards compatibility. | ||
| visibility?: PortVisibility; | ||
|
|
||
| // Public, outward-facing URL where the port can be accessed on. | ||
|
|
@@ -280,7 +283,7 @@ export interface IdeSetup { | |
| // WorkspaceInstanceConfiguration contains all per-instance configuration | ||
| export interface WorkspaceInstanceConfiguration { | ||
| // theiaVersion is the version of Theia this workspace instance uses | ||
| // @deprected: replaced with the ideImage field | ||
| // @deprecated: replaced with the ideImage field | ||
| theiaVersion?: string; | ||
|
|
||
| // feature flags are the lowercase feature-flag names as passed to ws-manager | ||
|
|
@@ -324,3 +327,19 @@ export interface ImageBuildLogInfo { | |
| url: string; | ||
| headers: { [key: string]: string }; | ||
| } | ||
|
|
||
| /** | ||
| * Holds metrics about the workspace instance | ||
| */ | ||
| export interface WorkspaceInstanceMetrics { | ||
| image?: Partial<{ | ||
| /** | ||
| * the total size of the image in bytes (includes Gitpod-specific layers like IDE) | ||
| */ | ||
| totalSize: number; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comments would be 🥇 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in |
||
| /** | ||
| * the size of the workspace image in bytes | ||
| */ | ||
| workspaceImageSize: number; | ||
| }>; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.