Skip to content

Commit 34f066f

Browse files
chore: cover compute api call with types
1 parent 30a1e9f commit 34f066f

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

src/types/api/compute.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import {EFlag} from './enums';
2+
import {TEndpoint, TLegacyNodeLocation, TPoolStats} from './nodes';
3+
import {TMetrics} from './tenant';
4+
5+
// endpoint: viewer/json/compute
6+
// source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
7+
8+
export interface TComputeInfo {
9+
Overall: EFlag;
10+
Tenants?: TComputeTenantInfo[];
11+
Errors?: string[];
12+
}
13+
14+
interface TComputeTenantInfo {
15+
Overall: EFlag;
16+
Name: string;
17+
Nodes?: TComputeNodeInfo[];
18+
}
19+
20+
interface TComputeNodeInfo {
21+
/** uint64 */
22+
StartTime: string;
23+
/** uint64 */
24+
ChangeTime: string;
25+
SystemLocation: TLegacyNodeLocation;
26+
/** double */
27+
LoadAverage: number[];
28+
NumberOfCpus: number;
29+
Overall: EFlag;
30+
NodeId: number;
31+
DataCenter: string;
32+
Rack: string;
33+
Host: string;
34+
Version: string;
35+
PoolStats?: TPoolStats[];
36+
Endpoints?: TEndpoint[];
37+
Roles?: string[];
38+
/** uint64 */
39+
MemoryUsed?: string;
40+
/** uint64 */
41+
MemoryLimit?: string;
42+
Metrics: TMetrics;
43+
Tablets?: TTabletStateInfo[];
44+
}
45+
46+
// Tablets in compute nodes
47+
// Types for tabletInfo and tablets inside nodes and storage endpoints are in tablet.ts
48+
interface TTabletStateInfo {
49+
Type: string;
50+
State: EFlag;
51+
Count: number;
52+
}

src/types/api/tenant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface THiveDomainStatsStateCount {
5454
Count?: number;
5555
}
5656

57-
interface TMetrics {
57+
export interface TMetrics {
5858
/** uint64 */
5959
CPU?: string;
6060
/** uint64 */

0 commit comments

Comments
 (0)