mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 08:17:33 +00:00
feat: update topology
This commit is contained in:
parent
480c175a4f
commit
1c0f7780d7
@ -25,6 +25,8 @@ import { store } from "@/store";
|
|||||||
import graphql from "@/graphql";
|
import graphql from "@/graphql";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { EBPFProfilingTriggerType } from "../data";
|
import { EBPFProfilingTriggerType } from "../data";
|
||||||
|
import dateFormatStep from "@/utils/dateFormat";
|
||||||
|
import getLocalTime from "@/utils/localtime";
|
||||||
|
|
||||||
interface ContinousProfilingState {
|
interface ContinousProfilingState {
|
||||||
strategyList: Array<Recordable<StrategyItem>>;
|
strategyList: Array<Recordable<StrategyItem>>;
|
||||||
@ -35,6 +37,7 @@ interface ContinousProfilingState {
|
|||||||
errorReason: string;
|
errorReason: string;
|
||||||
processes: Process[];
|
processes: Process[];
|
||||||
instances: Instance[];
|
instances: Instance[];
|
||||||
|
instance: Nullable<Instance>;
|
||||||
eBPFSchedules: EBPFProfilingSchedule[];
|
eBPFSchedules: EBPFProfilingSchedule[];
|
||||||
currentSchedule: EBPFProfilingSchedule | Record<string, never>;
|
currentSchedule: EBPFProfilingSchedule | Record<string, never>;
|
||||||
analyzeTrees: AnalyzationTrees[];
|
analyzeTrees: AnalyzationTrees[];
|
||||||
@ -58,6 +61,7 @@ export const continousProfilingStore = defineStore({
|
|||||||
currentSchedule: {},
|
currentSchedule: {},
|
||||||
analyzeTrees: [],
|
analyzeTrees: [],
|
||||||
aggregateType: "COUNT",
|
aggregateType: "COUNT",
|
||||||
|
instance: null,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setSelectedStrategy(task: Recordable<StrategyItem>) {
|
setSelectedStrategy(task: Recordable<StrategyItem>) {
|
||||||
@ -72,6 +76,9 @@ export const continousProfilingStore = defineStore({
|
|||||||
setAnalyzeTrees(tree: AnalyzationTrees[]) {
|
setAnalyzeTrees(tree: AnalyzationTrees[]) {
|
||||||
this.analyzeTrees = tree;
|
this.analyzeTrees = tree;
|
||||||
},
|
},
|
||||||
|
setCurrentInstance(instance: Nullable<Instance>) {
|
||||||
|
this.instance = instance;
|
||||||
|
},
|
||||||
async setContinuousProfilingPolicy(
|
async setContinuousProfilingPolicy(
|
||||||
serviceId: string,
|
serviceId: string,
|
||||||
targets: {
|
targets: {
|
||||||
@ -145,12 +152,21 @@ export const continousProfilingStore = defineStore({
|
|||||||
networkProfilingStore.setLinks([]);
|
networkProfilingStore.setLinks([]);
|
||||||
this.eBPFSchedules = [];
|
this.eBPFSchedules = [];
|
||||||
this.analyzeTrees = [];
|
this.analyzeTrees = [];
|
||||||
|
this.selectedTask = {};
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.selectedTask = this.taskList[0] || {};
|
this.selectedTask = this.taskList[0] || {};
|
||||||
this.setselectedTask(this.selectedTask);
|
this.setselectedTask(this.selectedTask);
|
||||||
this.preAnalyzeTask();
|
await this.getGraphData();
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
|
async getGraphData() {
|
||||||
|
if (this.selectedStrategy.type === "NETWORK") {
|
||||||
|
await this.getTopology();
|
||||||
|
} else {
|
||||||
|
await this.preAnalyzeTask();
|
||||||
|
}
|
||||||
|
},
|
||||||
async getServiceInstances(serviceId: string): Promise<Nullable<AxiosResponse>> {
|
async getServiceInstances(serviceId: string): Promise<Nullable<AxiosResponse>> {
|
||||||
if (!serviceId) {
|
if (!serviceId) {
|
||||||
return null;
|
return null;
|
||||||
@ -161,6 +177,7 @@ export const continousProfilingStore = defineStore({
|
|||||||
});
|
});
|
||||||
if (!res.data.errors) {
|
if (!res.data.errors) {
|
||||||
this.instances = res.data.data.pods || [];
|
this.instances = res.data.data.pods || [];
|
||||||
|
this.instance = this.instances[0] || null;
|
||||||
}
|
}
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
@ -177,6 +194,30 @@ export const continousProfilingStore = defineStore({
|
|||||||
}
|
}
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
|
async getTopology() {
|
||||||
|
const networkProfilingStore = useNetworkProfilingStore();
|
||||||
|
const appStore = useAppStoreWithOut();
|
||||||
|
networkProfilingStore.setSelectedNetworkTask(this.selectedTask);
|
||||||
|
const { taskStartTime, fixedTriggerDuration } = this.selectedTask;
|
||||||
|
const startTime =
|
||||||
|
fixedTriggerDuration > 1800 ? taskStartTime + fixedTriggerDuration * 1000 - 30 * 60 * 1000 : taskStartTime;
|
||||||
|
let endTime = taskStartTime + fixedTriggerDuration * 1000;
|
||||||
|
if (taskStartTime + fixedTriggerDuration * 1000 > new Date().getTime()) {
|
||||||
|
endTime = new Date().getTime();
|
||||||
|
}
|
||||||
|
const resp = await networkProfilingStore.getProcessTopology({
|
||||||
|
serviceInstanceId: this.instance.id || "",
|
||||||
|
duration: {
|
||||||
|
start: dateFormatStep(getLocalTime(appStore.utc, new Date(startTime)), appStore.duration.step, true),
|
||||||
|
end: dateFormatStep(getLocalTime(appStore.utc, new Date(endTime)), appStore.duration.step, true),
|
||||||
|
step: appStore.duration.step,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (resp.errors) {
|
||||||
|
ElMessage.error(resp.errors);
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
},
|
||||||
async getEBPFSchedules(params: { taskId: string }) {
|
async getEBPFSchedules(params: { taskId: string }) {
|
||||||
if (!params.taskId) {
|
if (!params.taskId) {
|
||||||
return new Promise((resolve) => resolve({}));
|
return new Promise((resolve) => resolve({}));
|
||||||
|
@ -37,15 +37,15 @@ limitations under the License. -->
|
|||||||
<span>
|
<span>
|
||||||
{{ `${cause.type}: ${getURI(cause.uri)}${cause.uri.threshold}>=${cause.uri.current}` }}
|
{{ `${cause.type}: ${getURI(cause.uri)}${cause.uri.threshold}>=${cause.uri.current}` }}
|
||||||
</span>
|
</span>
|
||||||
<a class="profile-view r" @click="viewDetail = true">
|
|
||||||
<Icon iconName="view" size="middle" />
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ell sm">
|
<div class="ell sm">
|
||||||
<span class="mr-10 sm">{{ dateFormat(i.taskStartTime) }}</span>
|
<span class="mr-10 sm">{{ dateFormat(i.taskStartTime) }}</span>
|
||||||
<span class="mr-10 sm">
|
<span class="mr-10 sm">
|
||||||
{{ dateFormat(i.taskStartTime + i.fixedTriggerDuration * 1000) }}
|
{{ dateFormat(i.taskStartTime + i.fixedTriggerDuration * 1000) }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="profile-view r" @click="viewDetail = true">
|
||||||
|
<Icon iconName="view" size="middle" />
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -63,12 +63,7 @@ limitations under the License. -->
|
|||||||
import type { EBPFTaskList } from "@/types/ebpf";
|
import type { EBPFTaskList } from "@/types/ebpf";
|
||||||
import TaskDetails from "../../components/TaskDetails.vue";
|
import TaskDetails from "../../components/TaskDetails.vue";
|
||||||
import { dateFormat } from "@/utils/dateFormat";
|
import { dateFormat } from "@/utils/dateFormat";
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
import { useContinousProfilingStore } from "@/store/modules/continous-profiling";
|
import { useContinousProfilingStore } from "@/store/modules/continous-profiling";
|
||||||
import { useNetworkProfilingStore } from "@/store/modules/network-profiling";
|
|
||||||
import { TargetTypes } from "../data";
|
|
||||||
import dateFormatStep from "@/utils/dateFormat";
|
|
||||||
import getLocalTime from "@/utils/localtime";
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const continousProfilingStore = useContinousProfilingStore();
|
const continousProfilingStore = useContinousProfilingStore();
|
||||||
@ -76,31 +71,9 @@ limitations under the License. -->
|
|||||||
|
|
||||||
async function changeTask(item: EBPFTaskList) {
|
async function changeTask(item: EBPFTaskList) {
|
||||||
continousProfilingStore.setselectedTask(item);
|
continousProfilingStore.setselectedTask(item);
|
||||||
continousProfilingStore.preAnalyzeTask();
|
continousProfilingStore.getGraphData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// async function getTopology() {
|
|
||||||
// const { taskStartTime, fixedTriggerDuration } = networkProfilingStore.selectedNetworkTask;
|
|
||||||
// const startTime =
|
|
||||||
// fixedTriggerDuration > 1800 ? taskStartTime + fixedTriggerDuration * 1000 - 30 * 60 * 1000 : taskStartTime;
|
|
||||||
// let endTime = taskStartTime + fixedTriggerDuration * 1000;
|
|
||||||
// if (taskStartTime + fixedTriggerDuration * 1000 > new Date().getTime()) {
|
|
||||||
// endTime = new Date().getTime();
|
|
||||||
// }
|
|
||||||
// const resp = await networkProfilingStore.getProcessTopology({
|
|
||||||
// serviceInstanceId: instanceId.value,
|
|
||||||
// duration: {
|
|
||||||
// start: dateFormatStep(getLocalTime(appStore.utc, new Date(startTime)), appStore.duration.step, true),
|
|
||||||
// end: dateFormatStep(getLocalTime(appStore.utc, new Date(endTime)), appStore.duration.step, true),
|
|
||||||
// step: appStore.duration.step,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// if (resp.errors) {
|
|
||||||
// ElMessage.error(resp.errors);
|
|
||||||
// }
|
|
||||||
// return resp;
|
|
||||||
// }
|
|
||||||
|
|
||||||
function getURI(uri: { uriRegex: string; uriPath: string }) {
|
function getURI(uri: { uriRegex: string; uriPath: string }) {
|
||||||
return uri ? `(${uri.uriRegex || ""} | ${uri.uriPath || ""})` : "";
|
return uri ? `(${uri.uriRegex || ""} | ${uri.uriPath || ""})` : "";
|
||||||
}
|
}
|
||||||
@ -163,7 +136,6 @@ limitations under the License. -->
|
|||||||
color: #3d444f;
|
color: #3d444f;
|
||||||
padding: 1px 3px;
|
padding: 1px 3px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
font-size: 12px;
|
font-size: 10px;
|
||||||
float: right;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user