Skip to content

Commit 9734099

Browse files
Copilotadameat
andcommitted
Add fields_required=-1 parameter to sysinfo API call for thread data
Co-authored-by: adameat <[email protected]>
1 parent 9c04132 commit 9734099

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

src/services/api/viewer.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export class ViewerAPI extends BaseYdbAPI {
6666
this.getPath('/viewer/json/sysinfo?enums=true'),
6767
{
6868
node_id: id,
69+
fields_required: -1,
6970
},
7071
{concurrentId, requestConfig: {signal}, timeout},
7172
);
@@ -600,17 +601,4 @@ export class ViewerAPI extends BaseYdbAPI {
600601
{concurrentId, requestConfig: {signal}},
601602
);
602603
}
603-
604-
getNodeThreads(nodeId: string | number, {concurrentId, signal}: AxiosOptions = {}) {
605-
// TODO: This endpoint needs to be implemented in the YDB backend
606-
// For now, we'll use the existing sysinfo endpoint and extract thread data
607-
// In the future, this should be a dedicated /viewer/json/threads endpoint
608-
return this.get<TEvSystemStateResponse>(
609-
this.getPath('/viewer/json/sysinfo?enums=true'),
610-
{
611-
node_id: nodeId,
612-
},
613-
{concurrentId: concurrentId || `getNodeThreads|${nodeId}`, requestConfig: {signal}},
614-
);
615-
}
616604
}

src/store/reducers/node/node.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,22 @@ export const nodeApi = api.injectEndpoints({
3030
getNodeThreads: build.query({
3131
queryFn: async ({nodeId}: {nodeId: string}, {signal}) => {
3232
try {
33-
const data = await window.api.viewer.getNodeThreads(nodeId, {signal});
34-
// TODO: Transform the data to extract detailed thread information
35-
// For now, return mock data matching the issue requirements
33+
const data = await window.api.viewer.getNodeInfo(nodeId, {signal});
34+
35+
// Extract thread information from the response
36+
// If the backend provides Threads field with detailed info, use it
37+
// Otherwise, fall back to mock data for development
38+
if (data.Threads && data.Threads.length > 0) {
39+
return {
40+
data: {
41+
Threads: data.Threads,
42+
ResponseTime: data.ResponseTime,
43+
ResponseDuration: data.ResponseDuration,
44+
},
45+
};
46+
}
47+
48+
// Fallback to mock data for development until backend is fully implemented
3649
const mockThreadData = {
3750
Threads: [
3851
{

src/types/api/systemState.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {TSystemStateInfo} from './nodes';
2+
import type {TThreadPoolInfo} from './threads';
23

34
/**
45
* endpoint: /viewer/json/sysinfo
@@ -7,6 +8,8 @@ import type {TSystemStateInfo} from './nodes';
78
*/
89
export interface TEvSystemStateResponse {
910
SystemStateInfo?: TSystemStateInfo[];
11+
/** Detailed thread information when fields_required=-1 is used */
12+
Threads?: TThreadPoolInfo[];
1013
/** uint64 */
1114
ResponseTime?: string;
1215
ResponseDuration?: number;

0 commit comments

Comments
 (0)