This commit is contained in:
Fine 2024-11-27 15:47:49 +08:00
parent 8d4184e0ab
commit 6920228f12
6 changed files with 19 additions and 28 deletions

View File

@ -20,7 +20,7 @@ limitations under the License. -->
<Filter /> <Filter />
</div> </div>
<div class="stack"> <div class="stack">
<EBPFStack :type="ComponentType" /> <Stack />
</div> </div>
</div> </div>
</div> </div>
@ -32,8 +32,7 @@ limitations under the License. -->
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import TaskList from "./components/TaskList.vue"; import TaskList from "./components/TaskList.vue";
import Filter from "./components/Filter.vue"; import Filter from "./components/Filter.vue";
import EBPFStack from "@/views/dashboard/related/ebpf/components/EBPFStack.vue"; import Stack from "./components/Stack.vue";
import { ComponentType } from "@/views/dashboard/related/ebpf/components/data";
const asyncProfilingStore = useAsyncProfilingStore(); const asyncProfilingStore = useAsyncProfilingStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();

View File

@ -59,7 +59,7 @@ limitations under the License. -->
); );
function changeInstances(options: Option[]) { function changeInstances(options: Option[]) {
serviceInstanceIds.value = options.map((d: any) => d.id); serviceInstanceIds.value = options.map((d: Option) => d.value);
} }
function changeEventType(options: Option[]) { function changeEventType(options: Option[]) {
@ -67,8 +67,11 @@ limitations under the License. -->
} }
async function analyzeProfiling() { async function analyzeProfiling() {
const instanceIds = asyncProfilingStore.instances
.filter((d: Instance) => (serviceInstanceIds.value ?? []).includes(d.value))
.map((d: Instance) => d.id);
const res = await asyncProfilingStore.getAsyncProfilingAnalyze({ const res = await asyncProfilingStore.getAsyncProfilingAnalyze({
instanceIds: serviceInstanceIds.value, instanceIds,
taskId: asyncProfilingStore.selectedTask.id, taskId: asyncProfilingStore.selectedTask.id,
eventType: (EventsMap as any)[selectedEventType.value], eventType: (EventsMap as any)[selectedEventType.value],
}); });

View File

@ -89,11 +89,10 @@ limitations under the License. -->
.attr("class", "d3-tip") .attr("class", "d3-tip")
.direction("s") .direction("s")
.html((d: { data: StackElement } & { parent: { data: StackElement } }) => { .html((d: { data: StackElement } & { parent: { data: StackElement } }) => {
const name = d.data.name.replace("<", "&lt;").replace(">", "&gt;"); const name = d.data.codeSignature;
const valStr = const valStr = asyncProfilingStore.aggregateType
asyncProfilingStore.aggregateType === asyncProfilingStore[0].value ? `<div class="mb-5">Dump Count: ${d.data.total}</div>`
? `<div class="mb-5">Dump Count: ${d.data.total}</div>` : `<div class="mb-5">Duration: ${d.data.total} ns</div>`;
: `<div class="mb-5">Duration: ${d.data.total} ns</div>`;
const rateOfParent = const rateOfParent =
(d.parent && (d.parent &&
`<div class="mb-5">Percentage Of Selected: ${ `<div class="mb-5">Percentage Of Selected: ${
@ -114,7 +113,7 @@ limitations under the License. -->
const list = []; const list = [];
for (const tree of asyncProfilingStore.analyzeTrees) { for (const tree of asyncProfilingStore.analyzeTrees) {
for (const ele of tree.elements) { for (const ele of tree.elements) {
list.push(ele.dumpCount); list.push(ele.total);
} }
} }
max.value = Math.max(...list); max.value = Math.max(...list);
@ -136,13 +135,13 @@ limitations under the License. -->
for (const item of copyArr) { for (const item of copyArr) {
if (item.parentId === "1") { if (item.parentId === "1") {
const val = Number(scale(item.dumpCount).toFixed(4)); const val = Number(scale(item.total).toFixed(4));
res = item; res = item;
res.value = val; res.value = val;
} }
for (const key in obj) { for (const key in obj) {
if (item.originId === obj[key].parentId) { if (item.originId === obj[key].parentId) {
const val = Number(scale(obj[key].dumpCount).toFixed(4)); const val = Number(scale(obj[key].total).toFixed(4));
obj[key].value = val; obj[key].value = val;
if (item.children) { if (item.children) {

View File

@ -95,9 +95,8 @@ limitations under the License. -->
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import type { Option } from "@/types/app"; import type { Option } from "@/types/app";
import { TableHeader, AggregateTypes, ComponentType } from "./data"; import { TableHeader, AggregateTypes } from "./data";
import { useEbpfStore } from "@/store/modules/ebpf"; import { useEbpfStore } from "@/store/modules/ebpf";
import { useContinousProfilingStore } from "@/store/modules/continous-profiling";
import type { EBPFProfilingSchedule, Process } from "@/types/ebpf"; import type { EBPFProfilingSchedule, Process } from "@/types/ebpf";
import { ElMessage, ElTable } from "element-plus"; import { ElMessage, ElTable } from "element-plus";
import { dateFormat } from "@/utils/dateFormat"; import { dateFormat } from "@/utils/dateFormat";
@ -110,7 +109,7 @@ limitations under the License. -->
default: "", default: "",
}, },
}); });
const ebpfStore = props.type === ComponentType ? useContinousProfilingStore() : useEbpfStore(); const ebpfStore = useEbpfStore();
const pageSize = 5; const pageSize = 5;
const multipleTableRef = ref<InstanceType<typeof ElTable>>(); const multipleTableRef = ref<InstanceType<typeof ElTable>>();
const selectedProcesses = ref<string[]>([]); const selectedProcesses = ref<string[]>([]);

View File

@ -23,20 +23,13 @@ limitations under the License. -->
import d3tip from "d3-tip"; import d3tip from "d3-tip";
import { flamegraph } from "d3-flame-graph"; import { flamegraph } from "d3-flame-graph";
import { useEbpfStore } from "@/store/modules/ebpf"; import { useEbpfStore } from "@/store/modules/ebpf";
import { useAsyncProfilingStore } from "@/store/modules/async-profiling";
import type { StackElement } from "@/types/ebpf"; import type { StackElement } from "@/types/ebpf";
import { AggregateTypes, ComponentType } from "./data"; import { AggregateTypes } from "./data";
import "d3-flame-graph/dist/d3-flamegraph.css"; import "d3-flame-graph/dist/d3-flamegraph.css";
import { treeForeach } from "@/utils/flameGraph"; import { treeForeach } from "@/utils/flameGraph";
/*global Nullable, defineProps*/ /*global Nullable*/
const props = defineProps({ const ebpfStore = useEbpfStore();
type: {
type: String,
default: "",
},
});
const ebpfStore = props.type === ComponentType ? useAsyncProfilingStore() : useEbpfStore();
const stackTree = ref<Nullable<StackElement>>(null); const stackTree = ref<Nullable<StackElement>>(null);
const selectStack = ref<Nullable<StackElement>>(null); const selectStack = ref<Nullable<StackElement>>(null);
const graph = ref<Nullable<HTMLDivElement>>(null); const graph = ref<Nullable<HTMLDivElement>>(null);

View File

@ -57,5 +57,3 @@ export const TableHeader = [
{ property: "name", label: "Name" }, { property: "name", label: "Name" },
{ property: "instanceName", label: "Instance Name" }, { property: "instanceName", label: "Instance Name" },
]; ];
export const ComponentType = "ASYNC_PROFILING";