get process topology

This commit is contained in:
Fine 2022-08-08 19:41:07 +08:00
parent 15d9612b36
commit fb5b7363e3
5 changed files with 53 additions and 7 deletions

View File

@ -83,7 +83,6 @@ export const ProcessTopology = {
nodes { nodes {
id id
name name
type
isReal isReal
serviceName serviceName
serviceId serviceId

View File

@ -1,4 +1,3 @@
import { TaskListItem } from "./../../types/profile.d";
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -22,11 +21,12 @@ import {
EBPFProfilingSchedule, EBPFProfilingSchedule,
EBPFTaskList, EBPFTaskList,
AnalyzationTrees, AnalyzationTrees,
ProcessNode,
} from "@/types/ebpf"; } from "@/types/ebpf";
import { store } from "@/store"; import { store } from "@/store";
import graphql from "@/graphql"; import graphql from "@/graphql";
import { AxiosResponse } from "axios"; import { AxiosResponse } from "axios";
import { Call } from "@/types/topology";
interface EbpfStore { interface EbpfStore {
taskList: EBPFTaskList[]; taskList: EBPFTaskList[];
networkTasks: EBPFTaskList[]; networkTasks: EBPFTaskList[];
@ -40,6 +40,8 @@ interface EbpfStore {
selectedTask: Recordable<EBPFTaskList>; selectedTask: Recordable<EBPFTaskList>;
selectedNetworkTask: Recordable<EBPFTaskList>; selectedNetworkTask: Recordable<EBPFTaskList>;
aggregateType: string; aggregateType: string;
nodes: ProcessNode[];
calls: Call[];
} }
export const ebpfStore = defineStore({ export const ebpfStore = defineStore({
@ -57,6 +59,8 @@ export const ebpfStore = defineStore({
selectedTask: {}, selectedTask: {},
selectedNetworkTask: {}, selectedNetworkTask: {},
aggregateType: "COUNT", aggregateType: "COUNT",
nodes: [],
calls: [],
}), }),
actions: { actions: {
setSelectedTask(task: EBPFTaskList) { setSelectedTask(task: EBPFTaskList) {
@ -207,6 +211,21 @@ export const ebpfStore = defineStore({
this.analyzeTrees = analysisEBPFResult.trees; this.analyzeTrees = analysisEBPFResult.trees;
return res.data; return res.data;
}, },
async getProcessTopology(params: {
duration: any;
serviceInstanceId: string;
}) {
const res: AxiosResponse = await graphql
.query("getProcessTopology")
.params(params);
if (res.data.errors) {
this.nodes = [];
this.calls = [];
return res.data;
}
const topo = res.data.data;
return res.data;
},
}, },
}); });

10
src/types/ebpf.d.ts vendored
View File

@ -75,3 +75,13 @@ export type AnalyzationTrees = {
dumpCount: number; dumpCount: number;
stackType: string; stackType: string;
}; };
export type ProcessNode = {
id: string;
name: string;
serviceId: string;
serviceName: string;
serviceInstanceId: string;
serviceInstanceName: string;
name: string;
isReal: boolean;
};

View File

@ -19,13 +19,16 @@ limitations under the License. -->
<div class="schedules"> <div class="schedules">
<Schedules /> <Schedules />
</div> </div>
<div class="item">EBPF Stack</div> <div class="item">
<Topology></Topology>
</div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import Tasks from "./components/Tasks.vue"; import Tasks from "./components/Tasks.vue";
import Schedules from "./components/Schedules.vue"; import Schedules from "./components/Schedules.vue";
import Topology from "./components/Topology.vue";
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {

View File

@ -16,13 +16,28 @@ limitations under the License. -->
<div ref="topology" class="topology"></div> <div ref="topology" class="topology"></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref, onMounted } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useEbpfStore } from "@/store/modules/ebpf"; import { useEbpfStore } from "@/store/modules/ebpf";
import { useSelectorStore } from "@/store/modules/selectors";
import { useAppStoreWithOut } from "@/store/modules/app";
/*global Nullable */ const selectorStore = useSelectorStore();
const { t } = useI18n();
const ebpfStore = useEbpfStore(); const ebpfStore = useEbpfStore();
const appStore = useAppStoreWithOut();
onMounted(() => {
getTopology();
});
function getTopology() {
const serviceInstanceId =
(selectorStore.currentPod && selectorStore.currentPod.id) || "";
ebpfStore.getProcessTopology({
serviceInstanceId,
duration: appStore.durationTime,
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.topology { .topology {