diff --git a/src/graphql/fragments/topology.ts b/src/graphql/fragments/topology.ts index a3d73cc0..d9fd901e 100644 --- a/src/graphql/fragments/topology.ts +++ b/src/graphql/fragments/topology.ts @@ -117,37 +117,7 @@ export const InstanceTopology = { } `, }; -export const TopoMetric = { - variable: "$ids: [ID!]!", - query: ` - sla: getValues(metric: { - name: "service_sla" - ids: $ids - }, duration: $duration) { - values { - id - value - } - } - nodeCpm: getValues(metric: { - name: "service_cpm" - ids: $ids - }, duration: $duration) { - values { - id - value - } - } - nodeLatency: getValues(metric: { - name: "service_resp_time" - ids: $ids - }, duration: $duration) { - values { - id - value - } - }`, -}; + export const TopoServiceMetric = { variable: "$idsS: [ID!]!", query: ` diff --git a/src/graphql/query/topology.ts b/src/graphql/query/topology.ts index faf3e82d..d488480d 100644 --- a/src/graphql/query/topology.ts +++ b/src/graphql/query/topology.ts @@ -19,22 +19,9 @@ import { EndpointTopology, ServiceTopology, GlobalTopology, - TopoMetric, - TopoServiceMetric, - TopoClientMetric, } from "../fragments/topology"; export const getGlobalTopology = `query queryData(${GlobalTopology.variable}) {${GlobalTopology.query}}`; export const getInstanceTopology = `query queryData(${InstanceTopology.variable}) {${InstanceTopology.query}}`; export const getServiceTopology = `query queryData(${ServiceTopology.variable}) {${ServiceTopology.query}}`; export const getEndpointTopology = `query queryData(${EndpointTopology.variable}) {${EndpointTopology.query}}`; -export const queryTopoInfo = `query queryTopoInfo( - ${GlobalTopology.variable}, - ${TopoMetric.variable}, - ${TopoServiceMetric.variable}, - ${TopoClientMetric.variable}) - { - ${TopoMetric.query}, - ${TopoServiceMetric.query}, - ${TopoClientMetric.query} - }`; diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts index 2b2ce80b..76471160 100644 --- a/src/hooks/useProcessor.ts +++ b/src/hooks/useProcessor.ts @@ -258,7 +258,7 @@ export function usePodsSource( }); return data; } -export function useQueryNodesMetrics(metrics: string[], ids: string[]) { +export function useQueryTopologyMetrics(metrics: string[], ids: string[]) { const appStore = useAppStoreWithOut(); const conditions: { [key: string]: unknown } = { duration: appStore.durationTime, diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index 04af4b3f..f60b4ec5 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -29,6 +29,8 @@ interface TopologyState { calls: Call[]; nodes: Node[]; nodeMetrics: { id: string; value: unknown }[]; + linkServerMetrics: { id: string; value: unknown }[]; + linkClientMetrics: { id: string; value: unknown }[]; } export const topologyStore = defineStore({ @@ -39,6 +41,8 @@ export const topologyStore = defineStore({ node: null, call: null, nodeMetrics: [], + linkServerMetrics: [], + linkClientMetrics: [], }), actions: { setNode(node: Node) { @@ -119,6 +123,30 @@ export const topologyStore = defineStore({ this.nodeMetrics = res.data.data; return res.data; }, + async getCallServerMetrics(param: { + queryStr: string; + conditions: { [key: string]: unknown }; + }) { + const res: AxiosResponse = await query(param); + + if (res.data.errors) { + return res.data; + } + this.linkServerMetrics = res.data.data; + return res.data; + }, + async getCallClientMetrics(param: { + queryStr: string; + conditions: { [key: string]: unknown }; + }) { + const res: AxiosResponse = await query(param); + + if (res.data.errors) { + return res.data; + } + this.linkClientMetrics = res.data.data; + return res.data; + }, }, }); diff --git a/src/views/dashboard/related/topology/Graph.vue b/src/views/dashboard/related/topology/Graph.vue index 93c20506..d4c24203 100644 --- a/src/views/dashboard/related/topology/Graph.vue +++ b/src/views/dashboard/related/topology/Graph.vue @@ -43,8 +43,8 @@ limitations under the License. -->