mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2026-05-27 01:28:37 +00:00
feat: update tasks query
This commit is contained in:
@@ -48,3 +48,9 @@ export const ControlsTypes = [
|
||||
"ThirdPartyApp",
|
||||
"ContinuousProfiling",
|
||||
];
|
||||
export enum EBPFProfilingTriggerType {
|
||||
// Appoint the task executing total duration
|
||||
FIXED_TIME,
|
||||
// Trigger by the reach the continuous profiling policy
|
||||
CONTINUOUS_PROFILING,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
import { defineStore } from "pinia";
|
||||
import type { StrategyItem, CheckItems } from "@/types/continous-profiling";
|
||||
import type { ProcessNode } from "@/types/ebpf";
|
||||
import type { ProcessNode, EBPFTaskList } from "@/types/ebpf";
|
||||
import { store } from "@/store";
|
||||
import graphql from "@/graphql";
|
||||
import type { AxiosResponse } from "axios";
|
||||
@@ -26,7 +26,10 @@ import type { DurationTime } from "@/types/app";
|
||||
|
||||
interface ContinousProfilingState {
|
||||
strategyList: Array<Recordable<StrategyItem>>;
|
||||
selectedStrategyTask: Recordable<StrategyItem>;
|
||||
selectedStrategy: Recordable<StrategyItem>;
|
||||
taskList: Array<Recordable<EBPFTaskList>>;
|
||||
selectedContinousTask: Recordable<EBPFTaskList>;
|
||||
errorTip: string;
|
||||
errorReason: string;
|
||||
nodes: ProcessNode[];
|
||||
calls: Call[];
|
||||
@@ -43,8 +46,11 @@ export const continousProfilingStore = defineStore({
|
||||
id: "continousProfiling",
|
||||
state: (): ContinousProfilingState => ({
|
||||
strategyList: [],
|
||||
selectedStrategyTask: {},
|
||||
selectedStrategy: {},
|
||||
taskList: [],
|
||||
selectedContinousTask: {},
|
||||
errorReason: "",
|
||||
errorTip: "",
|
||||
nodes: [],
|
||||
calls: [],
|
||||
node: null,
|
||||
@@ -56,8 +62,11 @@ export const continousProfilingStore = defineStore({
|
||||
loadNodes: false,
|
||||
}),
|
||||
actions: {
|
||||
setSelectedStrategyTask(task: Recordable<StrategyItem>) {
|
||||
this.selectedStrategyTask = task || {};
|
||||
setSelectedStrategy(task: Recordable<StrategyItem>) {
|
||||
this.selectedStrategy = task || {};
|
||||
},
|
||||
setSelectedContinousTask(task: Recordable<EBPFTaskList>) {
|
||||
this.selectedContinousTask = task || {};
|
||||
},
|
||||
setNode(node: Nullable<ProcessNode>) {
|
||||
this.node = node;
|
||||
@@ -146,13 +155,37 @@ export const continousProfilingStore = defineStore({
|
||||
id: index,
|
||||
};
|
||||
});
|
||||
this.setSelectedStrategyTask(this.strategyList[0] || {});
|
||||
this.setSelectedStrategy(this.strategyList[0] || {});
|
||||
if (!this.strategyList.length) {
|
||||
this.nodes = [];
|
||||
this.calls = [];
|
||||
}
|
||||
return res.data;
|
||||
},
|
||||
async getContinousTaskList(params: {
|
||||
serviceId: string;
|
||||
serviceInstanceId: string;
|
||||
targets: string[];
|
||||
triggerType: string;
|
||||
}) {
|
||||
if (!params.serviceId) {
|
||||
return new Promise((resolve) => resolve({}));
|
||||
}
|
||||
const res: AxiosResponse = await graphql.query("getEBPFTasks").params(params);
|
||||
|
||||
this.errorTip = "";
|
||||
if (res.data.errors) {
|
||||
return res.data;
|
||||
}
|
||||
this.taskList = res.data.data.queryEBPFTasks || [];
|
||||
this.selectedContinousTask = this.taskList[0] || {};
|
||||
this.setSelectedContinousTask(this.selectedContinousTask);
|
||||
if (!this.taskList.length) {
|
||||
this.nodes = [];
|
||||
this.calls = [];
|
||||
}
|
||||
return res.data;
|
||||
},
|
||||
async getProcessTopology(params: { duration: DurationTime; serviceInstanceId: string }) {
|
||||
this.loadNodes = true;
|
||||
const res: AxiosResponse = await graphql.query("getProcessTopology").params(params);
|
||||
|
||||
@@ -20,6 +20,7 @@ import type { EBPFTaskCreationRequest, EBPFProfilingSchedule, EBPFTaskList, Anal
|
||||
import { store } from "@/store";
|
||||
import graphql from "@/graphql";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { EBPFProfilingTriggerType } from "../data";
|
||||
interface EbpfState {
|
||||
taskList: Array<Recordable<EBPFTaskList>>;
|
||||
eBPFSchedules: EBPFProfilingSchedule[];
|
||||
@@ -77,6 +78,7 @@ export const ebpfStore = defineStore({
|
||||
this.getTaskList({
|
||||
serviceId: param.serviceId,
|
||||
targets: ["ON_CPU", "OFF_CPU"],
|
||||
triggerType: EBPFProfilingTriggerType.FIXED_TIME,
|
||||
});
|
||||
return res.data;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user