From 0c7462069f37ae4d2954b685707516ef20cbca5d Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Thu, 17 Jul 2025 13:03:57 +0800 Subject: [PATCH] fix: correct the service list for legends in trace graphs (#481) --- src/store/modules/trace.ts | 8 +++++--- .../dashboard/related/trace/components/List.vue | 13 +++++++++---- .../dashboard/related/trace/components/Tree.vue | 11 ++++++----- .../dashboard/related/trace/utils/d3-trace-list.ts | 3 ++- .../dashboard/related/trace/utils/d3-trace-tree.ts | 3 ++- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/store/modules/trace.ts b/src/store/modules/trace.ts index 023716c1..9c474dd2 100644 --- a/src/store/modules/trace.ts +++ b/src/store/modules/trace.ts @@ -35,6 +35,7 @@ interface TraceState { traceSpanLogs: Recordable[]; selectorStore: Recordable; selectedSpan: Recordable; + serviceList: string[]; } const { getDurationTime } = useDuration(); @@ -56,6 +57,7 @@ export const traceStore = defineStore({ }, traceSpanLogs: [], selectorStore: useSelectorStore(), + serviceList: [], }), actions: { setTraceCondition(data: Recordable) { @@ -180,9 +182,9 @@ export const traceStore = defineStore({ if (response.errors) { return response; } - const data = response.data.trace.spans; - - this.setTraceSpans(data || []); + const data = response.data.trace.spans || []; + this.serviceList = Array.from(new Set(data.map((i: Span) => i.serviceCode))); + this.setTraceSpans(data); return response; }, async getSpanLogs(params: Recordable) { diff --git a/src/views/dashboard/related/trace/components/List.vue b/src/views/dashboard/related/trace/components/List.vue index b252a914..b710c089 100644 --- a/src/views/dashboard/related/trace/components/List.vue +++ b/src/views/dashboard/related/trace/components/List.vue @@ -13,7 +13,12 @@ limitations under the License. -->