Skip to content

Commit

Permalink
feat: Add cloud endpoint to retrieve the instance metrics (#2469)
Browse files Browse the repository at this point in the history
## Description
Add cloud endpoint to retrieve the instance metrics.
  • Loading branch information
laurentluce authored Jun 3, 2024
1 parent 6abb49b commit 52bbc1b
Show file tree
Hide file tree
Showing 6 changed files with 686 additions and 246 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions cloud/api/protobuf/kurtosis_backend_server_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ service KurtosisCloudBackendServer {
rpc DeleteAlias(DeleteAliasRequest) returns (google.protobuf.Empty){};
rpc IsNewKurtosisVersionAvailable(IsNewKurtosisVersionAvailableRequest) returns(IsNewKurtosisVersionAvailableResponse){};
rpc UpgradeKurtosisVersion(UpgradeKurtosisVersionRequest) returns(google.protobuf.Empty){};
rpc GetInstanceMetrics(GetInstanceMetricsRequest) returns(GetInstanceMetricsResponse){};
}

message GetOrCreateApiKeyRequest {
Expand Down Expand Up @@ -309,3 +310,22 @@ message IsNewKurtosisVersionAvailableResponse {
message UpgradeKurtosisVersionRequest {
string access_token = 1;
}

message GetInstanceMetricsRequest {
string access_token = 1;
string instance_id = 2;
int32 interval = 3;
int32 utc_offset = 4;

enum Theme {
LIGHT = 0;
DARK = 1;
}

Theme theme = 5;
}

message GetInstanceMetricsResponse {
string metrics = 1;
}

13 changes: 11 additions & 2 deletions cloud/api/typescript/src/kurtosis_backend_server_api_connect.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"
// @generated by protoc-gen-connect-es v0.13.0 with parameter "target=ts"
// @generated from file kurtosis_backend_server_api.proto (package kurtosis_cloud, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import { Empty, MethodIdempotency, MethodKind } from "@bufbuild/protobuf";
import { AddAliasRequest, CancelPaymentSubscriptionArgs, ChangeUserActiveRequest, CheckPortAuthorizationRequest, DeleteAliasRequest, DeleteInstancesRequest, DeleteInstancesResponse, GetCloudInstanceConfigArgs, GetCloudInstanceConfigResponse, GetInstancesResponse, GetOrCreateApiKeyRequest, GetOrCreateApiKeyResponse, GetOrCreateInstanceRequest, GetOrCreateInstanceResponse, GetOrCreatePaymentConfigArgs, GetOrCreatePaymentConfigResponse, GetPortsRequest, GetPortsResponse, GetUnlockedPortsRequest, GetUnlockedPortsResponse, GetUserRequest, GetUserResponse, IsNewKurtosisVersionAvailableRequest, IsNewKurtosisVersionAvailableResponse, LockPortRequest, RefreshDefaultPaymentMethodArgs, UnlockPortRequest, UpdateAddressArgs, UpgradeKurtosisVersionRequest } from "./kurtosis_backend_server_api_pb.js";
import { AddAliasRequest, CancelPaymentSubscriptionArgs, ChangeUserActiveRequest, CheckPortAuthorizationRequest, DeleteAliasRequest, DeleteInstancesRequest, DeleteInstancesResponse, GetCloudInstanceConfigArgs, GetCloudInstanceConfigResponse, GetInstanceMetricsRequest, GetInstanceMetricsResponse, GetInstancesResponse, GetOrCreateApiKeyRequest, GetOrCreateApiKeyResponse, GetOrCreateInstanceRequest, GetOrCreateInstanceResponse, GetOrCreatePaymentConfigArgs, GetOrCreatePaymentConfigResponse, GetPortsRequest, GetPortsResponse, GetUnlockedPortsRequest, GetUnlockedPortsResponse, GetUserRequest, GetUserResponse, IsNewKurtosisVersionAvailableRequest, IsNewKurtosisVersionAvailableResponse, LockPortRequest, RefreshDefaultPaymentMethodArgs, UnlockPortRequest, UpdateAddressArgs, UpgradeKurtosisVersionRequest } from "./kurtosis_backend_server_api_pb.js";

/**
* @generated from service kurtosis_cloud.KurtosisCloudBackendServer
Expand Down Expand Up @@ -204,6 +204,15 @@ export const KurtosisCloudBackendServer = {
O: Empty,
kind: MethodKind.Unary,
},
/**
* @generated from rpc kurtosis_cloud.KurtosisCloudBackendServer.GetInstanceMetrics
*/
getInstanceMetrics: {
name: "GetInstanceMetrics",
I: GetInstanceMetricsRequest,
O: GetInstanceMetricsResponse,
kind: MethodKind.Unary,
},
}
} as const;

120 changes: 119 additions & 1 deletion cloud/api/typescript/src/kurtosis_backend_server_api_pb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.1 with parameter "target=ts"
// @generated by protoc-gen-es v1.8.0 with parameter "target=ts"
// @generated from file kurtosis_backend_server_api.proto (package kurtosis_cloud, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down Expand Up @@ -2122,3 +2122,121 @@ export class UpgradeKurtosisVersionRequest extends Message<UpgradeKurtosisVersio
}
}

/**
* @generated from message kurtosis_cloud.GetInstanceMetricsRequest
*/
export class GetInstanceMetricsRequest extends Message<GetInstanceMetricsRequest> {
/**
* @generated from field: string access_token = 1;
*/
accessToken = "";

/**
* @generated from field: string instance_id = 2;
*/
instanceId = "";

/**
* @generated from field: int32 interval = 3;
*/
interval = 0;

/**
* @generated from field: int32 utc_offset = 4;
*/
utcOffset = 0;

/**
* @generated from field: kurtosis_cloud.GetInstanceMetricsRequest.Theme theme = 5;
*/
theme = GetInstanceMetricsRequest_Theme.LIGHT;

constructor(data?: PartialMessage<GetInstanceMetricsRequest>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "kurtosis_cloud.GetInstanceMetricsRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "instance_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "interval", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 4, name: "utc_offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 5, name: "theme", kind: "enum", T: proto3.getEnumType(GetInstanceMetricsRequest_Theme) },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetInstanceMetricsRequest {
return new GetInstanceMetricsRequest().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetInstanceMetricsRequest {
return new GetInstanceMetricsRequest().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetInstanceMetricsRequest {
return new GetInstanceMetricsRequest().fromJsonString(jsonString, options);
}

static equals(a: GetInstanceMetricsRequest | PlainMessage<GetInstanceMetricsRequest> | undefined, b: GetInstanceMetricsRequest | PlainMessage<GetInstanceMetricsRequest> | undefined): boolean {
return proto3.util.equals(GetInstanceMetricsRequest, a, b);
}
}

/**
* @generated from enum kurtosis_cloud.GetInstanceMetricsRequest.Theme
*/
export enum GetInstanceMetricsRequest_Theme {
/**
* @generated from enum value: LIGHT = 0;
*/
LIGHT = 0,

/**
* @generated from enum value: DARK = 1;
*/
DARK = 1,
}
// Retrieve enum metadata with: proto3.getEnumType(GetInstanceMetricsRequest_Theme)
proto3.util.setEnumType(GetInstanceMetricsRequest_Theme, "kurtosis_cloud.GetInstanceMetricsRequest.Theme", [
{ no: 0, name: "LIGHT" },
{ no: 1, name: "DARK" },
]);

/**
* @generated from message kurtosis_cloud.GetInstanceMetricsResponse
*/
export class GetInstanceMetricsResponse extends Message<GetInstanceMetricsResponse> {
/**
* @generated from field: string metrics = 1;
*/
metrics = "";

constructor(data?: PartialMessage<GetInstanceMetricsResponse>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "kurtosis_cloud.GetInstanceMetricsResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "metrics", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetInstanceMetricsResponse {
return new GetInstanceMetricsResponse().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetInstanceMetricsResponse {
return new GetInstanceMetricsResponse().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetInstanceMetricsResponse {
return new GetInstanceMetricsResponse().fromJsonString(jsonString, options);
}

static equals(a: GetInstanceMetricsResponse | PlainMessage<GetInstanceMetricsResponse> | undefined, b: GetInstanceMetricsResponse | PlainMessage<GetInstanceMetricsResponse> | undefined): boolean {
return proto3.util.equals(GetInstanceMetricsResponse, a, b);
}
}

0 comments on commit 52bbc1b

Please sign in to comment.