fix: set up async profiling tasks (#443)

This commit is contained in:
Fine0830 2024-12-30 15:51:26 +08:00 committed by GitHub
parent c33d6c4180
commit 55b3867bea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 19 additions and 15 deletions

View File

@ -96,7 +96,10 @@ export const asyncProfilingStore = defineStore({
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
}); });
if (!res.data.errors) { if (!res.data.errors) {
this.instances = res.data.data.pods || []; this.instances = (res.data.data.pods || []).map((d: Instance) => {
d.value = d.id || "";
return d;
});
} }
return res.data; return res.data;
}, },

View File

@ -349,7 +349,7 @@ export const topologyStore = defineStore({
const json = await this.getEndpointTopology(ids); const json = await this.getEndpointTopology(ids);
if (depth > 2) { if (depth > 2) {
const pods = json.nodes const pods = json.nodes
.filter((d: Node) => ![...ids, ...endpointIds].includes(d.id) && d.name != userNodeName) .filter((d: Node) => ![...ids, ...endpointIds].includes(d.id) && d.name !== userNodeName)
.map((item: Node) => item.id); .map((item: Node) => item.id);
if (!pods.length) { if (!pods.length) {
const nodes = [...res.nodes, ...json.nodes]; const nodes = [...res.nodes, ...json.nodes];
@ -360,7 +360,7 @@ export const topologyStore = defineStore({
const topo = await this.getEndpointTopology(pods); const topo = await this.getEndpointTopology(pods);
if (depth > 3) { if (depth > 3) {
const endpoints = topo.nodes const endpoints = topo.nodes
.filter((d: Node) => ![...ids, ...pods, ...endpointIds].includes(d.id) && d.name != userNodeName) .filter((d: Node) => ![...ids, ...pods, ...endpointIds].includes(d.id) && d.name !== userNodeName)
.map((item: Node) => item.id); .map((item: Node) => item.id);
if (!endpoints.length) { if (!endpoints.length) {
const nodes = [...res.nodes, ...json.nodes, ...topo.nodes]; const nodes = [...res.nodes, ...json.nodes, ...topo.nodes];
@ -373,7 +373,7 @@ export const topologyStore = defineStore({
const nodeIds = data.nodes const nodeIds = data.nodes
.filter( .filter(
(d: Node) => (d: Node) =>
![...endpoints, ...ids, ...pods, ...endpointIds].includes(d.id) && d.name != userNodeName, ![...endpoints, ...ids, ...pods, ...endpointIds].includes(d.id) && d.name !== userNodeName,
) )
.map((item: Node) => item.id); .map((item: Node) => item.id);
if (!nodeIds.length) { if (!nodeIds.length) {

View File

@ -17,7 +17,7 @@
class Vec2 extends Float32Array { class Vec2 extends Float32Array {
constructor(v?: unknown, y?: unknown) { constructor(v?: unknown, y?: unknown) {
super(2); super(2);
if (v instanceof Vec2 || v instanceof Float32Array || (v instanceof Array && v.length == 2)) { if (v instanceof Vec2 || v instanceof Float32Array || (v instanceof Array && v.length === 2)) {
this[0] = v[0]; this[0] = v[0];
this[1] = v[1]; this[1] = v[1];
} else if (typeof v === "number" && typeof y === "number") { } else if (typeof v === "number" && typeof y === "number") {
@ -104,7 +104,7 @@ class Vec2 extends Float32Array {
} }
norm(out?: number[] | Vec2): number[] | Vec2 | undefined { norm(out?: number[] | Vec2): number[] | Vec2 | undefined {
const mag = Math.sqrt(this[0] * this[0] + this[1] * this[1]); const mag = Math.sqrt(this[0] * this[0] + this[1] * this[1]);
if (mag == 0) return this; if (mag === 0) return this;
out = out || this; out = out || this;
out[0] = this[0] / mag; out[0] = this[0] / mag;
out[1] = this[1] / mag; out[1] = this[1] / mag;

View File

@ -17,7 +17,7 @@
class Vec3 extends Float32Array { class Vec3 extends Float32Array {
constructor(v?: unknown, y?: unknown, z?: unknown) { constructor(v?: unknown, y?: unknown, z?: unknown) {
super(3); super(3);
if (v instanceof Vec3 || v instanceof Float32Array || (v instanceof Array && v.length == 3)) { if (v instanceof Vec3 || v instanceof Float32Array || (v instanceof Array && v.length === 3)) {
this[0] = v[0]; this[0] = v[0];
this[1] = v[1]; this[1] = v[1];
this[2] = v[2]; this[2] = v[2];
@ -150,7 +150,7 @@ class Vec3 extends Float32Array {
} }
static norm(x: unknown, y: unknown, z: unknown): Vec3 { static norm(x: unknown, y: unknown, z: unknown): Vec3 {
const rtn = new Vec3(); const rtn = new Vec3();
if (x instanceof Vec3 || x instanceof Float32Array || (x instanceof Array && x.length == 3)) { if (x instanceof Vec3 || x instanceof Float32Array || (x instanceof Array && x.length === 3)) {
rtn.copy(x); rtn.copy(x);
} else if (typeof x === "number" && typeof y === "number" && typeof z === "number") { } else if (typeof x === "number" && typeof y === "number" && typeof z === "number") {
rtn.xyz(x, y, z); rtn.xyz(x, y, z);

View File

@ -41,7 +41,7 @@ limitations under the License. -->
{{ dateFormat(i.createTime) }} {{ dateFormat(i.createTime) }}
</span> </span>
<span class="mr-10 sm"> <span class="mr-10 sm">
{{ dateFormat(i.createTime + i.duration * 60 * 1000) }} {{ dateFormat(i.createTime + i.duration * 1000) }}
</span> </span>
</div> </div>
</td> </td>

View File

@ -91,7 +91,7 @@ class Hex extends Int16Array {
} }
xyz(x: number, y: number, z: number | null = null): Hex { xyz(x: number, y: number, z: number | null = null): Hex {
if (z == null) z = -x - y; if (z === null) z = -x - y;
if (x + y + z != 0) { if (x + y + z != 0) {
console.log("Bad Axial Coordinate : : q %d r %d s %d", x, y, z); console.log("Bad Axial Coordinate : : q %d r %d s %d", x, y, z);
} }

View File

@ -21,9 +21,9 @@ limitations under the License. -->
<div class="item"> <div class="item">
<SpanTree @loading="loadTrees" @displayMode="setDisplayMode" /> <SpanTree @loading="loadTrees" @displayMode="setDisplayMode" />
<div class="thread-stack"> <div class="thread-stack">
<div id="graph-stack" ref="graph" v-show="displayMode == 'flame'" /> <div id="graph-stack" ref="graph" v-show="displayMode === 'flame'" />
<StackTable <StackTable
v-show="displayMode == 'tree'" v-show="displayMode === 'tree'"
v-if="profileStore.analyzeTrees.length" v-if="profileStore.analyzeTrees.length"
:data="profileStore.analyzeTrees" :data="profileStore.analyzeTrees"
:highlightTop="profileStore.highlightTop" :highlightTop="profileStore.highlightTop"

View File

@ -46,7 +46,7 @@ limitations under the License. -->
:class="{ :class="{
'trace-success': !i.isError, 'trace-success': !i.isError,
'trace-error': i.isError, 'trace-error': i.isError,
selected: selectedKey == i.key, selected: selectedKey === i.key,
}" }"
> >
<div <div

View File

@ -321,7 +321,7 @@ export default class ListGraph {
) )
.on("click", (event: any, d: Recordable) => { .on("click", (event: any, d: Recordable) => {
event.stopPropagation(); event.stopPropagation();
if (d.data.children.length == 0) return; if (d.data.children.length === 0) return;
this.click(d, this); this.click(d, this);
}); });
nodeUpdate nodeUpdate

View File

@ -296,7 +296,7 @@ export default class TraceMap {
.attr("cursor", "pointer") .attr("cursor", "pointer")
.on("click", (event: any, d: Recordable) => { .on("click", (event: any, d: Recordable) => {
event.stopPropagation(); event.stopPropagation();
if (d.data.children.length == 0) return; if (d.data.children.length === 0) return;
click(d); click(d);
}); });
const nodeExit = node const nodeExit = node

View File

@ -18,6 +18,7 @@
"extends": "./tsconfig.app.json", "extends": "./tsconfig.app.json",
"exclude": [], "exclude": [],
"compilerOptions": { "compilerOptions": {
"target": "esnext",
"lib": [], "lib": [],
"types": ["node", "jsdom"] "types": ["node", "jsdom"]
} }