feat: filter tasks with current process ID (#282)

This commit is contained in:
Fine0830 2023-06-13 14:48:38 +08:00 committed by GitHub
parent 62a82590c9
commit 8c9c339417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 18 deletions

View File

@ -43,11 +43,27 @@ export const queryEBPFTasks = {
serviceInstanceId serviceInstanceId
serviceInstanceName serviceInstanceName
processLabels processLabels
processName
processId
taskStartTime taskStartTime
triggerType triggerType
fixedTriggerDuration fixedTriggerDuration
targetType targetType
createTime createTime
continuousProfilingCauses {
type
singleValue {
threshold
current
}
uri {
uriRegex
uriPath
threshold
current
}
message
}
}`, }`,
}; };
export const queryEBPFSchedules = { export const queryEBPFSchedules = {

View File

@ -121,7 +121,7 @@ export const continousProfilingStore = defineStore({
id: index, id: index,
}; };
}); });
this.setSelectedStrategy(list[0] || {}); this.setSelectedStrategy(this.strategyList[0]);
if (!this.selectedStrategy.type) { if (!this.selectedStrategy.type) {
return res.data; return res.data;
} }

View File

@ -64,7 +64,10 @@ export const taskTimelineStore = defineStore({
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;
} }
this.taskList = res.data.data.queryEBPFTasks || []; const selectorStore = useSelectorStore();
this.taskList = (res.data.data.queryEBPFTasks || []).filter(
(d: EBPFTaskList) => selectorStore.currentProcess && d.processId === selectorStore.currentProcess.id,
);
// this.selectedTask = this.taskList[0] || {}; // this.selectedTask = this.taskList[0] || {};
// await this.getGraphData(); // await this.getGraphData();
return res.data; return res.data;

View File

@ -53,10 +53,6 @@ limitations under the License. -->
@change="changeMonitorType($event, index)" @change="changeMonitorType($event, index)"
/> />
</div> </div>
<div>
<div class="label">{{ t("count") }}</div>
<el-input-number size="small" class="profile-input" :min="0" v-model="item.count" @change="changeParam" />
</div>
<div> <div>
<div class="label"> <div class="label">
<span class="mr-5">{{ t("threshold") }}</span> <span class="mr-5">{{ t("threshold") }}</span>
@ -70,6 +66,10 @@ limitations under the License. -->
@change="changeThreshold(index)" @change="changeThreshold(index)"
/> />
</div> </div>
<div>
<div class="label">{{ t("count") }}</div>
<el-input-number size="small" class="profile-input" :min="0" v-model="item.count" @change="changeParam" />
</div>
<div> <div>
<div class="label">{{ t("period") }}</div> <div class="label">{{ t("period") }}</div>
<el-input-number size="small" class="profile-input" :min="0" v-model="item.period" @change="changeParam" /> <el-input-number size="small" class="profile-input" :min="0" v-model="item.period" @change="changeParam" />

View File

@ -71,7 +71,7 @@ limitations under the License. -->
.item { .item {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
height: calc(100% - 100px); height: calc(100% - 270px);
padding-bottom: 10px; padding-bottom: 10px;
} }

View File

@ -101,22 +101,19 @@ limitations under the License. -->
template(item: EBPFTaskList | any) { template(item: EBPFTaskList | any) {
const data = item.data || {}; const data = item.data || {};
const end = data.taskStartTime ? visDate(data.taskStartTime + data.fixedTriggerDuration * 1000) : ""; const end = data.taskStartTime ? visDate(data.taskStartTime + data.fixedTriggerDuration * 1000) : "";
let str = "";
for (const item of data.continuousProfilingCauses || []) {
str += `${item.message};`;
}
let tmp = ` let tmp = `
<div>Task ID: ${data.taskId || ""}</div> <div>Task ID: ${data.taskId || ""}</div>
<div>Service Name: ${data.serviceName || ""}</div>
<div>Service Instance Name: ${data.serviceInstanceName || ""}</div>
<div>Service Process Name: ${data.processName || ""}</div>
<div>Target Type: ${data.targetType || ""}</div> <div>Target Type: ${data.targetType || ""}</div>
<div>Trigger Type: ${data.triggerType || ""}</div> <div>Trigger Type: ${data.triggerType || ""}</div>
<div>Start Time: ${data.taskStartTime ? visDate(data.taskStartTime) : ""}</div> <div>Start Time: ${data.taskStartTime ? visDate(data.taskStartTime) : ""}</div>
<div>End Time: ${end}</div> <div>End Time: ${end}</div>
<div>Causes: ${str}</div>
<div>Process Labels: ${data.processLabels.join("; ") || ""}</div>`; <div>Process Labels: ${data.processLabels.join("; ") || ""}</div>`;
let str = ""; return tmp;
for (const item of data.continuousProfilingCauses || []) {
str += `<div>${item.type}: ${getURI(item.uri)}${item.uri.threshold}>=${item.uri.current}</div>`;
}
return tmp + str;
}, },
}, },
}; };
@ -132,7 +129,7 @@ limitations under the License. -->
} }
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 ? `(${uri.uriRegex || ""} | ${uri.uriPath || ""})` : "";
} }
function resize() { function resize() {
@ -156,7 +153,7 @@ limitations under the License. -->
taskTimelineStore.setTaskList([]); taskTimelineStore.setTaskList([]);
}); });
watch( watch(
() => selectorStore.currentPod, () => selectorStore.currentProcess,
() => { () => {
init(); init();
}, },