From 45f896bf3673edaa7f6aa4397bd03120b1d45059 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Mon, 23 May 2022 16:00:30 +0800 Subject: [PATCH] feat: visualize the OFF CPU eBPF profiling (#97) --- src/graphql/fragments/ebpf.ts | 4 +- src/store/modules/ebpf.ts | 17 +- src/views/dashboard/related/ebpf/Content.vue | 6 +- .../related/ebpf/components/EBPFSchedules.vue | 177 +++++++++++------- .../related/ebpf/components/NewTask.vue | 9 +- .../related/ebpf/components/TaskList.vue | 16 +- .../dashboard/related/ebpf/components/data.ts | 10 +- 7 files changed, 153 insertions(+), 86 deletions(-) diff --git a/src/graphql/fragments/ebpf.ts b/src/graphql/fragments/ebpf.ts index 7479b623..920065d4 100644 --- a/src/graphql/fragments/ebpf.ts +++ b/src/graphql/fragments/ebpf.ts @@ -75,9 +75,9 @@ export const queryEBPFSchedules = { export const analysisEBPFResult = { variable: - "$scheduleIdList: [ID!]!, $timeRanges: [EBPFProfilingAnalyzeTimeRange!]!", + "$scheduleIdList: [ID!]!, $timeRanges: [EBPFProfilingAnalyzeTimeRange!]!, $aggregateType: EBPFProfilingAnalyzeAggregateType", query: ` - analysisEBPFResult: analysisEBPFProfilingResult(scheduleIdList: $scheduleIdList, timeRanges: $timeRanges) { + analysisEBPFResult: analysisEBPFProfilingResult(scheduleIdList: $scheduleIdList, timeRanges: $timeRanges, aggregateType: $aggregateType) { tip trees { elements { diff --git a/src/store/modules/ebpf.ts b/src/store/modules/ebpf.ts index 2e8cf124..f43c649f 100644 --- a/src/store/modules/ebpf.ts +++ b/src/store/modules/ebpf.ts @@ -22,7 +22,6 @@ import { EBPFTaskList, AnalyzationTrees, } from "@/types/ebpf"; -import { Trace, Span } from "@/types/trace"; import { store } from "@/store"; import graphql from "@/graphql"; import { AxiosResponse } from "axios"; @@ -35,6 +34,7 @@ interface EbpfStore { labels: Option[]; couldProfiling: boolean; tip: string; + selectedTask: Recordable; } export const ebpfStore = defineStore({ @@ -47,14 +47,18 @@ export const ebpfStore = defineStore({ labels: [{ value: "", label: "" }], couldProfiling: false, tip: "", + selectedTask: {}, }), actions: { - setCurrentSpan(span: Span) { - this.currentSpan = span; + setSelectedTask(task: EBPFTaskList) { + this.selectedTask = task; }, - setCurrentSchedule(s: Trace) { + setCurrentSchedule(s: EBPFProfilingSchedule) { this.currentSchedule = s; }, + setAnalyzeTrees(tree: AnalyzationTrees[]) { + this.analyzeTrees = tree; + }, async getCreateTaskData(serviceId: string) { const res: AxiosResponse = await graphql .query("getCreateTaskData") @@ -93,7 +97,7 @@ export const ebpfStore = defineStore({ if (res.data.errors) { return res.data; } - this.taskList = res.data.data.queryEBPFTasks.reverse() || []; + this.taskList = res.data.data.queryEBPFTasks || []; if (!this.taskList.length) { return res.data; } @@ -118,13 +122,14 @@ export const ebpfStore = defineStore({ this.eBPFSchedules = eBPFSchedules; if (!eBPFSchedules.length) { this.eBPFSchedules = []; + this.analyzeTrees = []; } - this.analyzeTrees = []; return res.data; }, async getEBPFAnalyze(params: { scheduleIdList: string[]; timeRanges: Array<{ start: number; end: number }>; + aggregateType: string; }) { if (!params.scheduleIdList.length) { return new Promise((resolve) => resolve({})); diff --git a/src/views/dashboard/related/ebpf/Content.vue b/src/views/dashboard/related/ebpf/Content.vue index 91abfd26..019a20c4 100644 --- a/src/views/dashboard/related/ebpf/Content.vue +++ b/src/views/dashboard/related/ebpf/Content.vue @@ -46,11 +46,13 @@ import EBPFStack from "./components/EBPFStack.vue"; .item { width: 100%; overflow: auto; - height: calc(100% - 70px); + height: calc(100% - 100px); padding-bottom: 10px; } .schedules { - height: 60px; + height: 90px; + border-bottom: 1px solid #ccc; + padding-right: 10px; } diff --git a/src/views/dashboard/related/ebpf/components/EBPFSchedules.vue b/src/views/dashboard/related/ebpf/components/EBPFSchedules.vue index 3caaff0b..191b0097 100644 --- a/src/views/dashboard/related/ebpf/components/EBPFSchedules.vue +++ b/src/views/dashboard/related/ebpf/components/EBPFSchedules.vue @@ -13,74 +13,87 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->