fix: update profiling

This commit is contained in:
Fine 2023-03-28 22:05:24 +08:00
parent bdd376ffb3
commit e02f91deef
3 changed files with 18 additions and 4 deletions

View File

@ -69,6 +69,7 @@ export const profileStore = defineStore({
},
setCurrentTask(task: TaskListItem) {
this.currentTask = task || {};
this.analyzeTrees = [];
},
setSegmentSpans(spans: Recordable<SegmentSpan>[]) {
const index = spans.length - 1 || 0;
@ -77,9 +78,18 @@ export const profileStore = defineStore({
},
setCurrentSpan(span: Recordable<SegmentSpan>) {
this.currentSpan = span;
this.analyzeTrees = [];
},
setCurrentSegment(s: Recordable<Trace>) {
this.currentSegment = s;
setCurrentSegment(segment: Trace) {
this.currentSegment = segment;
this.segmentSpans = segment.spans || [];
if (segment.spans) {
const index = segment.spans.length - 1 || 0;
this.currentSpan = segment.spans[index];
} else {
this.currentSpan = {};
}
this.analyzeTrees = [];
},
setHighlightTop() {
this.highlightTop = !this.highlightTop;

View File

@ -20,7 +20,7 @@ limitations under the License. -->
{{ t("noData") }}
</div>
<table class="profile-t">
<tr class="profile-tr cp" v-for="(i, index) in profileStore.segmentList" @click="selectTrace(i)" :key="index">
<tr class="profile-tr cp" v-for="(i, index) in profileStore.segmentList" @click="selectSegment(i)" :key="index">
<td
class="profile-td"
:class="{
@ -57,7 +57,7 @@ limitations under the License. -->
const profileStore = useProfileStore();
const key = computed(() => (profileStore.currentSpan && profileStore.currentSpan.segmentId) || "");
async function selectTrace(item: Trace) {
async function selectSegment(item: Trace) {
profileStore.setCurrentSegment(item);
profileStore.setSegmentSpans(item.spans);
}

View File

@ -69,6 +69,10 @@ limitations under the License. -->
}
async function analyzeProfile() {
if (!profileStore.currentSpan.profiled) {
ElMessage.info("It's a un-profiled span");
return;
}
emits("loading", true);
updateTimeRange();
const params = timeRange.value.map((t: { start: number; end: number }) => {