mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-22 22:55:25 +00:00
feat: update tasks query
This commit is contained in:
parent
b8ad72e1cc
commit
2c38d9c1f8
@ -33,9 +33,10 @@ export const createEBPFTask = {
|
||||
}`,
|
||||
};
|
||||
export const queryEBPFTasks = {
|
||||
variable: "$serviceId: ID, $serviceInstanceId: ID, $targets: [EBPFProfilingTargetType!]",
|
||||
variable:
|
||||
"$serviceId: ID, $serviceInstanceId: ID, $targets: [EBPFProfilingTargetType!], triggerType: EBPFProfilingTriggerType",
|
||||
query: `
|
||||
queryEBPFTasks: queryEBPFProfilingTasks(serviceId: $serviceId, serviceInstanceId: $serviceInstanceId, targets: $targets) {
|
||||
queryEBPFTasks: queryEBPFProfilingTasks(serviceId: $serviceId, serviceInstanceId: $serviceInstanceId, targets: $targets, triggerType: $triggerType) {
|
||||
taskId
|
||||
serviceName
|
||||
serviceId
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ limitations under the License. -->
|
||||
<td
|
||||
class="profile-td"
|
||||
:class="{
|
||||
selected: continousProfilingStore.selectedStrategyTask.id === i.id,
|
||||
selected: continousProfilingStore.selectedStrategy.id === i.id,
|
||||
}"
|
||||
>
|
||||
<div class="ell">
|
||||
@ -84,7 +84,7 @@ limitations under the License. -->
|
||||
}
|
||||
|
||||
async function changePolicy(item: StrategyItem) {
|
||||
continousProfilingStore.setSelectedStrategyTask(item);
|
||||
continousProfilingStore.setSelectedStrategy(item);
|
||||
}
|
||||
|
||||
function setStrategies() {
|
||||
|
@ -33,6 +33,7 @@ limitations under the License. -->
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||
import { EntityType } from "../../data";
|
||||
import { EBPFProfilingTriggerType } from "@/store/data";
|
||||
|
||||
/*global defineProps */
|
||||
const props = defineProps({
|
||||
@ -54,6 +55,7 @@ limitations under the License. -->
|
||||
const res = await ebpfStore.getTaskList({
|
||||
serviceId,
|
||||
targets: ["ON_CPU", "OFF_CPU"],
|
||||
triggerType: EBPFProfilingTriggerType.FIXED_TIME,
|
||||
});
|
||||
|
||||
if (res.errors) {
|
||||
|
@ -77,6 +77,7 @@ limitations under the License. -->
|
||||
import getLocalTime from "@/utils/localtime";
|
||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||
import NewTask from "./NewTask.vue";
|
||||
import { EBPFProfilingTriggerType } from "@/store/data";
|
||||
|
||||
/*global Nullable */
|
||||
const { t } = useI18n();
|
||||
@ -185,6 +186,7 @@ limitations under the License. -->
|
||||
serviceId,
|
||||
serviceInstanceId,
|
||||
targets: ["NETWORK"],
|
||||
triggerType: EBPFProfilingTriggerType.FIXED_TIME,
|
||||
});
|
||||
|
||||
if (res.errors) {
|
||||
|
Loading…
Reference in New Issue
Block a user