Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/store/modules/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ export const traceStore = defineStore({
return response;
},
async getTraces() {
this.loading = true;
if (this.hasQueryTracesV2Support) {
return this.fetchV2Traces();
Comment thread
Fine0830 marked this conversation as resolved.
}
this.loading = true;
const response = await graphql.query("queryTraces").params({ condition: this.conditions });
if (response.errors) {
this.loading = false;
Expand All @@ -193,14 +193,15 @@ export const traceStore = defineStore({
this.loading = false;
return response;
}
this.getTraceSpans({ traceId: response.data.data.traces[0].traceIds[0] });
this.traceList = response.data.data.traces.map((d: Trace) => {
d.traceIds = d.traceIds.map((id: string) => {
return { value: id, label: id };
});
return d;
});
this.setCurrentTrace(response.data.data.traces[0] || {});
const currentTrace = this.traceList[0] || {};
this.setCurrentTrace(currentTrace);
await this.getTraceSpans({ traceId: currentTrace.traceIds?.[0]?.value || "" });
return response;
},
async getTraceSpans(params: { traceId: string }) {
Expand Down Expand Up @@ -301,6 +302,27 @@ export const traceStore = defineStore({
this.setCurrentTrace(trace || {});
return response;
},

async getTraceByTraceId(traceId: string) {
this.loading = true;
this.setTraceCondition({
traceId: traceId,
});
await this.getHasQueryTracesV2Support();
if (this.hasQueryTracesV2Support) {
await this.fetchV2Traces();
this.loading = false;
return;
}
this.setCurrentTrace({
traceIds: [{ value: traceId, label: traceId }],
traceId: traceId,
endpointNames: [],
spans: [],
});
await this.getTraceSpans({ traceId });
Comment thread
Fine0830 marked this conversation as resolved.
this.loading = false;
Comment thread
Fine0830 marked this conversation as resolved.
},
},
});

Expand Down
21 changes: 12 additions & 9 deletions src/views/dashboard/Trace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<div style="padding: 20px">
<TraceContent v-if="traceStore.currentTrace" :trace="traceStore.currentTrace" />
<div style="text-align: center; padding: 20px" v-if="!traceStore.loading && !traceStore.currentTrace"
>No trace found</div
>
<div v-if="traceStore.traceSpans.length">
<TraceContent
v-if="traceStore.hasQueryTracesV2Support && traceStore.currentTrace"
:trace="traceStore.currentTrace"
/>
<SpanList v-if="!traceStore.hasQueryTracesV2Support" />
</div>
<div style="text-align: center; padding: 20px" v-else> No trace found </div>
</div>
</template>

Expand All @@ -26,17 +30,16 @@ limitations under the License. -->
import { computed, onMounted, provide } from "vue";
import { useTraceStore } from "@/store/modules/trace";
import TraceContent from "@/views/dashboard/related/trace/components/TraceQuery/TraceContent.vue";
import SpanList from "@/views/dashboard/related/trace/components/TraceList/SpanList.vue";

const route = useRoute();
const traceStore = useTraceStore();
const traceId = computed(() => route.params.traceId as string);
provide("options", {});
onMounted(() => {
if (traceId.value) {
traceStore.setTraceCondition({
traceId: traceId.value,
});
traceStore.fetchV2Traces();
if (!traceId.value) {
return;
}
traceStore.getTraceByTraceId(traceId.value);
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ limitations under the License. -->
:traceId="traceStore.currentTrace?.traceIds?.[0]?.value"
:showBtnDetail="false"
:headerType="WidgetType.Trace"
:minTimestamp="NaN"
:maxTimestamp="NaN"
/>
</div>
</div>
Expand Down
Loading