ydb-embedded-ui 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -0
- package/dist/components/DateRange/DateRange.scss +11 -0
- package/dist/{containers/Tenant/Diagnostics/TopShards → components}/DateRange/DateRange.tsx +7 -7
- package/dist/{containers/Tenant/Diagnostics/TopShards → components}/DateRange/index.ts +0 -0
- package/dist/components/Illustration/Illustration.tsx +4 -11
- package/dist/components/InfoViewer/InfoViewer.scss +2 -0
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.tsx +1 -1
- package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +16 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +4 -5
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +7 -7
- package/dist/containers/Tenant/Diagnostics/{TopShards/TopShards.scss → OverloadedShards/OverloadedShards.scss} +1 -1
- package/dist/containers/Tenant/Diagnostics/{TopShards/TopShards.tsx → OverloadedShards/OverloadedShards.tsx} +10 -11
- package/dist/containers/Tenant/Diagnostics/{TopShards → OverloadedShards}/i18n/en.json +0 -0
- package/dist/containers/Tenant/Diagnostics/OverloadedShards/i18n/index.ts +11 -0
- package/dist/containers/Tenant/Diagnostics/{TopShards → OverloadedShards}/i18n/ru.json +0 -0
- package/dist/containers/Tenant/Diagnostics/OverloadedShards/index.ts +1 -0
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.scss +16 -19
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +202 -0
- package/dist/containers/Tenant/Diagnostics/TopQueries/i18n/en.json +4 -0
- package/dist/containers/Tenant/Diagnostics/{TopShards → TopQueries}/i18n/index.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/TopQueries/i18n/ru.json +4 -0
- package/dist/containers/Tenant/Diagnostics/TopQueries/index.ts +1 -0
- package/dist/containers/UserSettings/UserSettings.tsx +1 -1
- package/dist/services/api.d.ts +7 -0
- package/dist/store/reducers/describe.ts +4 -1
- package/dist/store/reducers/executeTopQueries.ts +170 -0
- package/dist/store/reducers/settings.js +1 -1
- package/dist/store/reducers/shardsWorkload.ts +9 -9
- package/dist/store/reducers/storage.js +2 -0
- package/dist/store/reducers/{tablets.js → tablets.ts} +30 -17
- package/dist/store/state-url-mapping.js +10 -2
- package/dist/types/api/compute.ts +52 -0
- package/dist/types/api/consumer.ts +257 -0
- package/dist/types/api/enums.ts +2 -2
- package/dist/types/api/nodes.ts +5 -2
- package/dist/types/api/pdisk.ts +3 -0
- package/dist/types/api/schema.ts +1 -0
- package/dist/types/api/storage.ts +31 -28
- package/dist/types/api/tablet.ts +18 -2
- package/dist/types/api/tenant.ts +4 -1
- package/dist/types/api/topic.ts +157 -0
- package/dist/types/api/vdisk.ts +3 -0
- package/dist/types/store/executeTopQueries.ts +29 -0
- package/dist/types/store/schema.ts +3 -3
- package/dist/types/store/shardsWorkload.ts +3 -3
- package/dist/types/store/tablets.ts +42 -0
- package/dist/utils/getNodesColumns.js +8 -1
- package/package.json +3 -3
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +0 -188
- package/dist/containers/Tenant/Diagnostics/TopShards/DateRange/DateRange.scss +0 -13
- package/dist/containers/Tenant/Diagnostics/TopShards/index.ts +0 -1
- package/dist/store/reducers/executeTopQueries.js +0 -66
- package/dist/types/api/consumers.ts +0 -3
@@ -2,7 +2,6 @@ import {createSelector, Selector} from 'reselect';
|
|
2
2
|
import {Reducer} from 'redux';
|
3
3
|
|
4
4
|
import '../../services/api';
|
5
|
-
import {IConsumer} from '../../types/api/consumers';
|
6
5
|
import {
|
7
6
|
IDescribeRootStateSlice,
|
8
7
|
IDescribeState,
|
@@ -100,6 +99,10 @@ const selectConsumersNames = (state: IDescribeRootStateSlice, path?: string) =>
|
|
100
99
|
? state.describe.data[path]?.PathDescription?.PersQueueGroup?.PQTabletConfig?.ReadRules
|
101
100
|
: undefined;
|
102
101
|
|
102
|
+
interface IConsumer {
|
103
|
+
name: string;
|
104
|
+
}
|
105
|
+
|
103
106
|
export const selectConsumers: Selector<IDescribeRootStateSlice, IConsumer[], [string | undefined]> =
|
104
107
|
createSelector(selectConsumersNames, (names = []) => names.map((name) => ({name})));
|
105
108
|
|
@@ -0,0 +1,170 @@
|
|
1
|
+
import type {AnyAction, Reducer} from 'redux';
|
2
|
+
import type {ThunkAction} from 'redux-thunk';
|
3
|
+
|
4
|
+
import '../../services/api';
|
5
|
+
import {
|
6
|
+
ITopQueriesAction,
|
7
|
+
ITopQueriesFilters,
|
8
|
+
ITopQueriesState,
|
9
|
+
} from '../../types/store/executeTopQueries';
|
10
|
+
import {IQueryResult} from '../../types/store/query';
|
11
|
+
|
12
|
+
import {parseQueryAPIExecuteResponse} from '../../utils/query';
|
13
|
+
|
14
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
15
|
+
|
16
|
+
import type {IRootState} from '.';
|
17
|
+
|
18
|
+
export const FETCH_TOP_QUERIES = createRequestActionTypes('top-queries', 'FETCH_TOP_QUERIES');
|
19
|
+
const SET_TOP_QUERIES_STATE = 'top-queries/SET_TOP_QUERIES_STATE';
|
20
|
+
const SET_TOP_QUERIES_FILTERS = 'top-queries/SET_TOP_QUERIES_FILTERS';
|
21
|
+
|
22
|
+
const initialState = {
|
23
|
+
loading: false,
|
24
|
+
wasLoaded: false,
|
25
|
+
filters: {},
|
26
|
+
};
|
27
|
+
|
28
|
+
const getMaxIntervalSubquery = (path: string) => `(
|
29
|
+
SELECT
|
30
|
+
MAX(IntervalEnd)
|
31
|
+
FROM \`${path}/.sys/top_queries_by_cpu_time_one_hour\`
|
32
|
+
)`;
|
33
|
+
|
34
|
+
function getFiltersConditions(path: string, filters?: ITopQueriesFilters) {
|
35
|
+
const conditions: string[] = [];
|
36
|
+
|
37
|
+
if (filters?.from && filters?.to && filters.from > filters.to) {
|
38
|
+
throw new Error('Invalid date range');
|
39
|
+
}
|
40
|
+
|
41
|
+
if (filters?.from) {
|
42
|
+
// matching `from` & `to` is an edge case
|
43
|
+
// other cases should not include the starting point, since intervals are stored using the ending time
|
44
|
+
const gt = filters.to === filters.from ? '>=' : '>';
|
45
|
+
conditions.push(`IntervalEnd ${gt} Timestamp('${new Date(filters.from).toISOString()}')`);
|
46
|
+
}
|
47
|
+
|
48
|
+
if (filters?.to) {
|
49
|
+
conditions.push(`IntervalEnd <= Timestamp('${new Date(filters.to).toISOString()}')`);
|
50
|
+
}
|
51
|
+
|
52
|
+
if (!filters?.from && !filters?.to) {
|
53
|
+
conditions.push(`IntervalEnd IN ${getMaxIntervalSubquery(path)}`);
|
54
|
+
}
|
55
|
+
|
56
|
+
if (filters?.text) {
|
57
|
+
conditions.push(`QueryText ILIKE '%${filters.text}%'`);
|
58
|
+
}
|
59
|
+
|
60
|
+
return conditions.join(' AND ');
|
61
|
+
}
|
62
|
+
|
63
|
+
const getQueryText = (path: string, filters?: ITopQueriesFilters) => {
|
64
|
+
const filterConditions = getFiltersConditions(path, filters);
|
65
|
+
return `
|
66
|
+
SELECT
|
67
|
+
CPUTime as CPUTimeUs,
|
68
|
+
QueryText,
|
69
|
+
IntervalEnd
|
70
|
+
FROM \`${path}/.sys/top_queries_by_cpu_time_one_hour\`
|
71
|
+
WHERE ${filterConditions || 'true'}
|
72
|
+
`;
|
73
|
+
};
|
74
|
+
|
75
|
+
const executeTopQueries: Reducer<ITopQueriesState, ITopQueriesAction> = (
|
76
|
+
state = initialState,
|
77
|
+
action,
|
78
|
+
) => {
|
79
|
+
switch (action.type) {
|
80
|
+
case FETCH_TOP_QUERIES.REQUEST: {
|
81
|
+
return {
|
82
|
+
...state,
|
83
|
+
loading: true,
|
84
|
+
error: undefined,
|
85
|
+
};
|
86
|
+
}
|
87
|
+
case FETCH_TOP_QUERIES.SUCCESS: {
|
88
|
+
return {
|
89
|
+
...state,
|
90
|
+
data: action.data,
|
91
|
+
loading: false,
|
92
|
+
error: undefined,
|
93
|
+
wasLoaded: true,
|
94
|
+
};
|
95
|
+
}
|
96
|
+
// 401 Unauthorized error is handled by GenericAPI
|
97
|
+
case FETCH_TOP_QUERIES.FAILURE: {
|
98
|
+
return {
|
99
|
+
...state,
|
100
|
+
error: action.error || 'Unauthorized',
|
101
|
+
loading: false,
|
102
|
+
};
|
103
|
+
}
|
104
|
+
case SET_TOP_QUERIES_STATE:
|
105
|
+
return {
|
106
|
+
...state,
|
107
|
+
...action.data,
|
108
|
+
};
|
109
|
+
case SET_TOP_QUERIES_FILTERS:
|
110
|
+
return {
|
111
|
+
...state,
|
112
|
+
filters: {
|
113
|
+
...state.filters,
|
114
|
+
...action.filters,
|
115
|
+
},
|
116
|
+
};
|
117
|
+
default:
|
118
|
+
return state;
|
119
|
+
}
|
120
|
+
};
|
121
|
+
|
122
|
+
type FetchTopQueries = (params: {
|
123
|
+
database: string;
|
124
|
+
filters?: ITopQueriesFilters;
|
125
|
+
}) => ThunkAction<Promise<IQueryResult | undefined>, IRootState, unknown, AnyAction>;
|
126
|
+
|
127
|
+
export const fetchTopQueries: FetchTopQueries =
|
128
|
+
({database, filters}) =>
|
129
|
+
async (dispatch, getState) => {
|
130
|
+
try {
|
131
|
+
return createApiRequest({
|
132
|
+
request: window.api.sendQuery(
|
133
|
+
{
|
134
|
+
schema: 'modern',
|
135
|
+
query: getQueryText(database, filters),
|
136
|
+
database,
|
137
|
+
action: 'execute-scan',
|
138
|
+
},
|
139
|
+
{
|
140
|
+
concurrentId: 'executeTopQueries',
|
141
|
+
},
|
142
|
+
),
|
143
|
+
actions: FETCH_TOP_QUERIES,
|
144
|
+
dataHandler: parseQueryAPIExecuteResponse,
|
145
|
+
})(dispatch, getState);
|
146
|
+
} catch (error) {
|
147
|
+
dispatch({
|
148
|
+
type: FETCH_TOP_QUERIES.FAILURE,
|
149
|
+
error,
|
150
|
+
});
|
151
|
+
|
152
|
+
throw error;
|
153
|
+
}
|
154
|
+
};
|
155
|
+
|
156
|
+
export function setTopQueriesState(state: Partial<ITopQueriesState>) {
|
157
|
+
return {
|
158
|
+
type: SET_TOP_QUERIES_STATE,
|
159
|
+
data: state,
|
160
|
+
} as const;
|
161
|
+
}
|
162
|
+
|
163
|
+
export function setTopQueriesFilters(filters: Partial<ITopQueriesFilters>) {
|
164
|
+
return {
|
165
|
+
type: SET_TOP_QUERIES_FILTERS,
|
166
|
+
filters,
|
167
|
+
} as const;
|
168
|
+
}
|
169
|
+
|
170
|
+
export default executeTopQueries;
|
@@ -30,7 +30,7 @@ export const initialState = {
|
|
30
30
|
...defaultUserSettings,
|
31
31
|
...userSettings,
|
32
32
|
[THEME_KEY]: readSavedSettingsValue(THEME_KEY, 'light'),
|
33
|
-
[INVERTED_DISKS_KEY]: readSavedSettingsValue(INVERTED_DISKS_KEY
|
33
|
+
[INVERTED_DISKS_KEY]: readSavedSettingsValue(INVERTED_DISKS_KEY, 'false'),
|
34
34
|
[SAVED_QUERIES_KEY]: readSavedSettingsValue(SAVED_QUERIES_KEY, '[]'),
|
35
35
|
[TENANT_INITIAL_TAB_KEY]: readSavedSettingsValue(TENANT_INITIAL_TAB_KEY),
|
36
36
|
[QUERY_INITIAL_RUN_ACTION_KEY]: readSavedSettingsValue(QUERY_INITIAL_RUN_ACTION_KEY),
|
@@ -12,8 +12,8 @@ import {parseQueryAPIExecuteResponse} from '../../utils/query';
|
|
12
12
|
import {createRequestActionTypes, createApiRequest} from '../utils';
|
13
13
|
|
14
14
|
export const SEND_SHARD_QUERY = createRequestActionTypes('query', 'SEND_SHARD_QUERY');
|
15
|
-
const
|
16
|
-
const
|
15
|
+
const SET_SHARD_STATE = 'query/SET_SHARD_STATE';
|
16
|
+
const SET_SHARD_QUERY_FILTERS = 'shardsWorkload/SET_SHARD_QUERY_FILTERS';
|
17
17
|
|
18
18
|
const initialState = {
|
19
19
|
loading: false,
|
@@ -115,12 +115,12 @@ const shardsWorkload: Reducer<IShardsWorkloadState, IShardsWorkloadAction> = (
|
|
115
115
|
loading: false,
|
116
116
|
};
|
117
117
|
}
|
118
|
-
case
|
118
|
+
case SET_SHARD_STATE:
|
119
119
|
return {
|
120
120
|
...state,
|
121
121
|
...action.data,
|
122
122
|
};
|
123
|
-
case
|
123
|
+
case SET_SHARD_QUERY_FILTERS:
|
124
124
|
return {
|
125
125
|
...state,
|
126
126
|
filters: {
|
@@ -151,7 +151,7 @@ export const sendShardQuery = ({database, path = '', sortOrder, filters}: SendSh
|
|
151
151
|
action: queryAction,
|
152
152
|
},
|
153
153
|
{
|
154
|
-
concurrentId: '
|
154
|
+
concurrentId: 'shardsWorkload',
|
155
155
|
},
|
156
156
|
),
|
157
157
|
actions: SEND_SHARD_QUERY,
|
@@ -165,16 +165,16 @@ export const sendShardQuery = ({database, path = '', sortOrder, filters}: SendSh
|
|
165
165
|
}
|
166
166
|
};
|
167
167
|
|
168
|
-
export function
|
168
|
+
export function setShardsState(options: Partial<IShardsWorkloadState>) {
|
169
169
|
return {
|
170
|
-
type:
|
170
|
+
type: SET_SHARD_STATE,
|
171
171
|
data: options,
|
172
172
|
} as const;
|
173
173
|
}
|
174
174
|
|
175
|
-
export function
|
175
|
+
export function setShardsQueryFilters(filters: Partial<IShardsWorkloadFilters>) {
|
176
176
|
return {
|
177
|
-
type:
|
177
|
+
type: SET_SHARD_QUERY_FILTERS,
|
178
178
|
filters,
|
179
179
|
} as const;
|
180
180
|
}
|
@@ -307,6 +307,8 @@ export const getFlatListStorageNodes = createSelector([getStorageNodes], (storag
|
|
307
307
|
return {
|
308
308
|
NodeId: node.NodeId,
|
309
309
|
FQDN: systemState.Host,
|
310
|
+
DataCenter: systemState.DataCenter,
|
311
|
+
Rack: systemState.Rack,
|
310
312
|
uptime: calcUptime(systemState.StartTime),
|
311
313
|
StartTime: systemState.StartTime,
|
312
314
|
PDisks: node.PDisks,
|
@@ -1,7 +1,20 @@
|
|
1
|
-
import {
|
1
|
+
import type {Reducer} from 'redux';
|
2
2
|
import '../../services/api';
|
3
3
|
|
4
|
-
|
4
|
+
import type {ETabletState, EType} from '../../types/api/tablet';
|
5
|
+
import type {
|
6
|
+
ITabletsAction,
|
7
|
+
ITabletsApiRequestParams,
|
8
|
+
ITabletsState,
|
9
|
+
} from '../../types/store/tablets';
|
10
|
+
|
11
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
12
|
+
|
13
|
+
export const FETCH_TABLETS = createRequestActionTypes('tablets', 'FETCH_TABLETS');
|
14
|
+
|
15
|
+
const CLEAR_WAS_LOADING_TABLETS = 'tablets/CLEAR_WAS_LOADING_TABLETS';
|
16
|
+
const SET_STATE_FILTER = 'tablets/SET_STATE_FILTER';
|
17
|
+
const SET_TYPE_FILTER = 'tablets/SET_TYPE_FILTER';
|
5
18
|
|
6
19
|
const initialState = {
|
7
20
|
loading: true,
|
@@ -10,13 +23,12 @@ const initialState = {
|
|
10
23
|
typeFilter: [],
|
11
24
|
};
|
12
25
|
|
13
|
-
const tablets =
|
26
|
+
const tablets: Reducer<ITabletsState, ITabletsAction> = (state = initialState, action) => {
|
14
27
|
switch (action.type) {
|
15
28
|
case FETCH_TABLETS.REQUEST: {
|
16
29
|
return {
|
17
30
|
...state,
|
18
31
|
loading: true,
|
19
|
-
requestTime: new Date().getTime(),
|
20
32
|
};
|
21
33
|
}
|
22
34
|
case FETCH_TABLETS.SUCCESS: {
|
@@ -35,20 +47,20 @@ const tablets = function z(state = initialState, action) {
|
|
35
47
|
loading: false,
|
36
48
|
};
|
37
49
|
}
|
38
|
-
case
|
50
|
+
case CLEAR_WAS_LOADING_TABLETS: {
|
39
51
|
return {
|
40
52
|
...state,
|
41
53
|
wasLoaded: false,
|
42
54
|
loading: true,
|
43
55
|
};
|
44
56
|
}
|
45
|
-
case
|
57
|
+
case SET_STATE_FILTER: {
|
46
58
|
return {
|
47
59
|
...state,
|
48
60
|
stateFilter: action.data,
|
49
61
|
};
|
50
62
|
}
|
51
|
-
case
|
63
|
+
case SET_TYPE_FILTER: {
|
52
64
|
return {
|
53
65
|
...state,
|
54
66
|
typeFilter: action.data,
|
@@ -59,25 +71,26 @@ const tablets = function z(state = initialState, action) {
|
|
59
71
|
}
|
60
72
|
};
|
61
73
|
|
62
|
-
export const setStateFilter = (stateFilter) => {
|
74
|
+
export const setStateFilter = (stateFilter: ETabletState[]) => {
|
63
75
|
return {
|
64
|
-
type:
|
76
|
+
type: SET_STATE_FILTER,
|
65
77
|
data: stateFilter,
|
66
|
-
};
|
78
|
+
} as const;
|
67
79
|
};
|
68
80
|
|
69
|
-
export const setTypeFilter = (typeFilter) => {
|
81
|
+
export const setTypeFilter = (typeFilter: EType[]) => {
|
70
82
|
return {
|
71
|
-
type:
|
83
|
+
type: SET_TYPE_FILTER,
|
72
84
|
data: typeFilter,
|
73
|
-
};
|
85
|
+
} as const;
|
74
86
|
};
|
75
87
|
|
76
|
-
export const clearWasLoadingFlag = () =>
|
77
|
-
|
78
|
-
|
88
|
+
export const clearWasLoadingFlag = () =>
|
89
|
+
({
|
90
|
+
type: CLEAR_WAS_LOADING_TABLETS,
|
91
|
+
} as const);
|
79
92
|
|
80
|
-
export function getTabletsInfo(data) {
|
93
|
+
export function getTabletsInfo(data: ITabletsApiRequestParams) {
|
81
94
|
return createApiRequest({
|
82
95
|
request: window.api.getTabletsInfo(data),
|
83
96
|
actions: FETCH_TABLETS,
|
@@ -48,14 +48,22 @@ const paramSetup = {
|
|
48
48
|
generalTab: {
|
49
49
|
stateKey: 'tenant.diagnosticsTab',
|
50
50
|
},
|
51
|
-
|
51
|
+
shardsDateFrom: {
|
52
52
|
stateKey: 'shardsWorkload.filters.from',
|
53
53
|
type: 'number',
|
54
54
|
},
|
55
|
-
|
55
|
+
shardsDateTo: {
|
56
56
|
stateKey: 'shardsWorkload.filters.to',
|
57
57
|
type: 'number',
|
58
58
|
},
|
59
|
+
topQueriesDateFrom: {
|
60
|
+
stateKey: 'executeTopQueries.filters.from',
|
61
|
+
type: 'number',
|
62
|
+
},
|
63
|
+
topQueriesDateTo: {
|
64
|
+
stateKey: 'executeTopQueries.filters.to',
|
65
|
+
type: 'number',
|
66
|
+
},
|
59
67
|
},
|
60
68
|
};
|
61
69
|
|
@@ -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
|
+
}
|
@@ -0,0 +1,257 @@
|
|
1
|
+
/* eslint-disable camelcase */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* endpoint: /json/describe_consumer
|
5
|
+
*
|
6
|
+
* source: https://github.com/ydb-platform/ydb/blob/main/ydb/public/api/protos/ydb_topic.proto
|
7
|
+
*
|
8
|
+
* Original proto file doesn't specify optional fields, so every field is considered optional
|
9
|
+
*/
|
10
|
+
export interface DescribeConsumerResult {
|
11
|
+
self?: Entry;
|
12
|
+
consumer?: Consumer;
|
13
|
+
partitions?: PartitionInfo[];
|
14
|
+
}
|
15
|
+
|
16
|
+
/** Partition info types differs for consumer and topic, although they are very similar */
|
17
|
+
export interface PartitionInfo {
|
18
|
+
/** int64 */
|
19
|
+
partition_id?: string;
|
20
|
+
|
21
|
+
/** Is partition open for write. */
|
22
|
+
active?: boolean;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* int64
|
26
|
+
*
|
27
|
+
* Ids of partitions which was formed when this partition was split or merged.
|
28
|
+
*/
|
29
|
+
child_partition_ids?: string[];
|
30
|
+
|
31
|
+
/**
|
32
|
+
* int64
|
33
|
+
*
|
34
|
+
* Ids of partitions from which this partition was formed by split or merge.
|
35
|
+
*/
|
36
|
+
parent_partition_ids?: string[];
|
37
|
+
|
38
|
+
/** Stats for partition, filled only when include_stats in request is true. */
|
39
|
+
partition_stats?: PartitionStats;
|
40
|
+
|
41
|
+
/** Stats for consumer of this partition, filled only when include_stats in request is true. */
|
42
|
+
partition_consumer_stats?: PartitionConsumerStats;
|
43
|
+
}
|
44
|
+
|
45
|
+
interface PartitionConsumerStats {
|
46
|
+
/**
|
47
|
+
* int64
|
48
|
+
*
|
49
|
+
* Last read offset from this partition.
|
50
|
+
*/
|
51
|
+
last_read_offset?: string;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* int64
|
55
|
+
*
|
56
|
+
* Committed offset for this partition.
|
57
|
+
*/
|
58
|
+
committed_offset?: string;
|
59
|
+
|
60
|
+
/** Reading this partition read session identifier. */
|
61
|
+
read_session_id?: string;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* google.protobuf.Timestamp
|
65
|
+
*
|
66
|
+
* Timestamp of providing this partition to this session by server.
|
67
|
+
*/
|
68
|
+
partition_read_session_create_time?: string;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* google.protobuf.Timestamp
|
72
|
+
*
|
73
|
+
* Timestamp of last read from this partition. */
|
74
|
+
last_read_time?: string;
|
75
|
+
|
76
|
+
/**
|
77
|
+
* google.protobuf.Duration
|
78
|
+
*
|
79
|
+
* Maximum of differences between timestamp of read and write timestamp for all messages, read during last minute.
|
80
|
+
*/
|
81
|
+
max_read_time_lag?: string;
|
82
|
+
|
83
|
+
/**
|
84
|
+
* google.protobuf.Duration
|
85
|
+
*
|
86
|
+
* Maximum of differences between write timestamp and create timestamp for all messages, read during last minute.
|
87
|
+
*/
|
88
|
+
max_write_time_lag?: string;
|
89
|
+
|
90
|
+
/** How much bytes were read during several windows statistics from this partiton. */
|
91
|
+
bytes_read?: MultipleWindowsStat;
|
92
|
+
|
93
|
+
/** Read session name, provided by client. */
|
94
|
+
reader_name?: string;
|
95
|
+
|
96
|
+
/** Host where read session connected. */
|
97
|
+
connection_node_id?: number;
|
98
|
+
}
|
99
|
+
|
100
|
+
export interface PartitionStats {
|
101
|
+
/** Partition contains messages with offsets in range [start, end). */
|
102
|
+
partition_offsets?: OffsetsRange;
|
103
|
+
|
104
|
+
/**
|
105
|
+
* int64
|
106
|
+
*
|
107
|
+
* Approximate size of partition.
|
108
|
+
*/
|
109
|
+
store_size_bytes?: string;
|
110
|
+
|
111
|
+
/**
|
112
|
+
* google.protobuf.Timestamp
|
113
|
+
*
|
114
|
+
* Timestamp of last write.
|
115
|
+
*/
|
116
|
+
last_write_time?: string;
|
117
|
+
|
118
|
+
/**
|
119
|
+
* google.protobuf.Duration
|
120
|
+
*
|
121
|
+
* Maximum of differences between write timestamp and create timestamp for all messages, written during last minute.
|
122
|
+
*/
|
123
|
+
max_write_time_lag?: string;
|
124
|
+
|
125
|
+
/** How much bytes were written during several windows in this partition. */
|
126
|
+
bytes_written?: MultipleWindowsStat;
|
127
|
+
|
128
|
+
/** Host where tablet for this partition works. Useful for debugging purposes. */
|
129
|
+
partition_node_id?: number;
|
130
|
+
}
|
131
|
+
|
132
|
+
interface OffsetsRange {
|
133
|
+
/** int64 */
|
134
|
+
start?: string;
|
135
|
+
/** int64 */
|
136
|
+
end?: string;
|
137
|
+
}
|
138
|
+
|
139
|
+
export interface Consumer {
|
140
|
+
/** Must have valid not empty name as a key. */
|
141
|
+
name?: string;
|
142
|
+
|
143
|
+
/** Consumer may be marked as 'important'. It means messages for this consumer will never expire due to retention. */
|
144
|
+
important?: boolean;
|
145
|
+
|
146
|
+
/**
|
147
|
+
* google.protobuf.Timestamp
|
148
|
+
*
|
149
|
+
* All messages with smaller server written_at timestamp will be skipped.
|
150
|
+
*/
|
151
|
+
read_from?: string;
|
152
|
+
|
153
|
+
/**
|
154
|
+
* List of supported codecs by this consumer.
|
155
|
+
*
|
156
|
+
* supported_codecs on topic must be contained inside this list.
|
157
|
+
*/
|
158
|
+
supported_codecs?: SupportedCodecs;
|
159
|
+
|
160
|
+
/** Attributes of consumer */
|
161
|
+
attributes?: Record<string, string>;
|
162
|
+
|
163
|
+
/** Filled only when requested statistics in Describe*Request. */
|
164
|
+
consumer_stats?: ConsumerStats;
|
165
|
+
}
|
166
|
+
|
167
|
+
interface ConsumerStats {
|
168
|
+
/**
|
169
|
+
* google.protobuf.Timestamp
|
170
|
+
*
|
171
|
+
* Minimal timestamp of last read from partitions.
|
172
|
+
*/
|
173
|
+
min_partitions_last_read_time?: string;
|
174
|
+
|
175
|
+
/**
|
176
|
+
* google.protobuf.Duration
|
177
|
+
*
|
178
|
+
* Maximum of differences between timestamp of read and write timestamp for all messages, read during last minute.
|
179
|
+
*/
|
180
|
+
max_read_time_lag?: string;
|
181
|
+
|
182
|
+
/**
|
183
|
+
* google.protobuf.Duration
|
184
|
+
*
|
185
|
+
* Maximum of differences between write timestamp and create timestamp for all messages, read during last minute.
|
186
|
+
*/
|
187
|
+
max_write_time_lag?: string;
|
188
|
+
|
189
|
+
/** Bytes read stastics. */
|
190
|
+
bytes_read?: MultipleWindowsStat;
|
191
|
+
}
|
192
|
+
|
193
|
+
export interface MultipleWindowsStat {
|
194
|
+
/** int64 */
|
195
|
+
per_minute?: string;
|
196
|
+
/** int64 */
|
197
|
+
per_hour?: string;
|
198
|
+
/** int64 */
|
199
|
+
per_day?: string;
|
200
|
+
}
|
201
|
+
|
202
|
+
export interface SupportedCodecs {
|
203
|
+
/** List of supported codecs. */
|
204
|
+
codecs?: number[];
|
205
|
+
}
|
206
|
+
|
207
|
+
export interface Entry {
|
208
|
+
/** For consumer will be topic-name/consumer-name */
|
209
|
+
name?: string;
|
210
|
+
|
211
|
+
owner?: string;
|
212
|
+
type?: Type;
|
213
|
+
effective_permissions?: Permissions[];
|
214
|
+
permissions?: Permissions[];
|
215
|
+
|
216
|
+
/**
|
217
|
+
* uint64
|
218
|
+
*
|
219
|
+
* Size of entry in bytes. Currently filled for:
|
220
|
+
* - TABLE;
|
221
|
+
* - DATABASE.
|
222
|
+
*
|
223
|
+
* Empty (zero) in other cases.
|
224
|
+
*/
|
225
|
+
size_bytes?: string;
|
226
|
+
|
227
|
+
/** Virtual timestamp when the object was created */
|
228
|
+
created_at?: VirtualTimestamp;
|
229
|
+
}
|
230
|
+
|
231
|
+
interface Permissions {
|
232
|
+
subject?: string;
|
233
|
+
permission_names?: string[];
|
234
|
+
}
|
235
|
+
|
236
|
+
interface VirtualTimestamp {
|
237
|
+
/** uint64 */
|
238
|
+
plan_step?: string;
|
239
|
+
/** uint64 */
|
240
|
+
tx_id?: string;
|
241
|
+
}
|
242
|
+
|
243
|
+
enum Type {
|
244
|
+
TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED',
|
245
|
+
DIRECTORY = 'DIRECTORY',
|
246
|
+
TABLE = 'TABLE',
|
247
|
+
PERS_QUEUE_GROUP = 'PERS_QUEUE_GROUP',
|
248
|
+
DATABASE = 'DATABASE',
|
249
|
+
RTMR_VOLUME = 'RTMR_VOLUME',
|
250
|
+
BLOCK_STORE_VOLUME = 'BLOCK_STORE_VOLUME',
|
251
|
+
COORDINATION_NODE = 'COORDINATION_NODE',
|
252
|
+
COLUMN_STORE = 'COLUMN_STORE ',
|
253
|
+
COLUMN_TABLE = 'COLUMN_TABLE ',
|
254
|
+
SEQUENCE = 'SEQUENCE ',
|
255
|
+
REPLICATION = 'REPLICATION ',
|
256
|
+
TOPIC = 'TOPIC ',
|
257
|
+
}
|