diff --git a/src/hooks/useListConfig.ts b/src/hooks/useListConfig.ts index 8c199a07..e8b13f6b 100644 --- a/src/hooks/useListConfig.ts +++ b/src/hooks/useListConfig.ts @@ -15,16 +15,24 @@ * limitations under the License. */ import { MetricQueryTypes, Calculations } from "./data"; +import { ExpressionResultType } from "@/views/dashboard/data"; + export function useListConfig(config: Indexable, index: string) { const i = Number(index); const types = [Calculations.Average, Calculations.ApdexAvg, Calculations.PercentageAvg]; const calculation = config.metricConfig && config.metricConfig[i] && config.metricConfig[i].calculation; const isLinear = - [MetricQueryTypes.ReadMetricsValues, MetricQueryTypes.ReadLabeledMetricsValues].includes(config.metricTypes[i]) && - !types.includes(calculation); + [ + MetricQueryTypes.ReadMetricsValues, + MetricQueryTypes.ReadLabeledMetricsValues, + ExpressionResultType.TIME_SERIES_VALUES, + ].includes(config.metricTypes[i]) && !types.includes(calculation); const isAvg = - [MetricQueryTypes.ReadMetricsValues, MetricQueryTypes.ReadLabeledMetricsValues].includes(config.metricTypes[i]) && - types.includes(calculation); + [ + MetricQueryTypes.ReadMetricsValues, + MetricQueryTypes.ReadLabeledMetricsValues, + ExpressionResultType.TIME_SERIES_VALUES, + ].includes(config.metricTypes[i]) && types.includes(calculation); return { isLinear, isAvg, diff --git a/src/hooks/useMetricsProcessor.ts b/src/hooks/useMetricsProcessor.ts index ee083b76..b0bbaf71 100644 --- a/src/hooks/useMetricsProcessor.ts +++ b/src/hooks/useMetricsProcessor.ts @@ -22,6 +22,7 @@ import { useSelectorStore } from "@/store/modules/selectors"; import { useAppStoreWithOut } from "@/store/modules/app"; import type { Instance, Endpoint, Service } from "@/types/selector"; import type { MetricConfigOpt } from "@/types/dashboard"; +import type { E } from "vitest/dist/types-c441ef31"; export function useQueryProcessor(config: Indexable) { if (!(config.metrics && config.metrics[0])) { @@ -277,7 +278,7 @@ export function usePodsSource( const names: string[] = []; const metricConfigArr: MetricConfigOpt[] = []; const metricTypesArr: string[] = []; - const data = pods.map((d: Instance & Indexable, idx: number) => { + const data = pods.map((d: any, idx: number) => { config.metrics.map((name: string, index: number) => { const c: any = (config.metricConfig && config.metricConfig[index]) || {}; const key = name + idx + index; diff --git a/src/types/selector.d.ts b/src/types/selector.d.ts index f4a63a28..f1b4a3f4 100644 --- a/src/types/selector.d.ts +++ b/src/types/selector.d.ts @@ -21,6 +21,7 @@ export type Service = { layers?: string[]; normal?: boolean; group?: string; + merge?: string; }; export type Instance = { @@ -30,12 +31,14 @@ export type Instance = { instanceUUID?: string; attributes?: { name: string; value: string }[]; id?: string; + merge?: boolean; }; export type Endpoint = { id?: string; label: string; value: string; + merge?: string; }; export type Service = { diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue index 3a3b8ab3..49ff8306 100644 --- a/src/views/dashboard/graphs/EndpointList.vue +++ b/src/views/dashboard/graphs/EndpointList.vue @@ -120,10 +120,18 @@ limitations under the License. --> endpoints.value = resp.data.pods || []; queryEndpointMetrics(endpoints.value); } - async function queryEndpointMetrics(currentPods: Endpoint[]) { - if (!currentPods.length) { + async function queryEndpointMetrics(arr: Endpoint[]) { + if (!arr.length) { return; } + const currentPods = arr.map((d: Endpoint) => { + return { + id: d.id, + value: d.value, + label: d.label, + merge: d.merge, + }; + }); if (props.config.metricMode === "Expression") { queryEndpointExpressions(currentPods); return; diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue index acbae744..e376118f 100644 --- a/src/views/dashboard/graphs/InstanceList.vue +++ b/src/views/dashboard/graphs/InstanceList.vue @@ -150,10 +150,21 @@ limitations under the License. --> queryInstanceMetrics(instances.value); } - async function queryInstanceMetrics(currentInstances: Instance[]) { - if (!currentInstances.length) { + async function queryInstanceMetrics(arr: Instance[]) { + if (!arr.length) { return; } + const currentInstances = arr.map((d: Instance) => { + return { + id: d.id, + value: d.value, + label: d.label, + merge: d.merge, + language: d.language, + instanceUUID: d.instanceUUID, + attributes: d.attributes, + }; + }); if (props.config.metricMode === "Expression") { queryInstanceExpressions(currentInstances); return; diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue index 66d1808d..c81cfa70 100644 --- a/src/views/dashboard/graphs/ServiceList.vue +++ b/src/views/dashboard/graphs/ServiceList.vue @@ -191,10 +191,21 @@ limitations under the License. --> router.push(path); } - async function queryServiceMetrics(currentServices: Service[]) { - if (!currentServices.length) { + async function queryServiceMetrics(arr: Service[]) { + if (!arr.length) { return; } + const currentServices = arr.map((d: Service) => { + return { + id: d.id, + value: d.value, + label: d.label, + layers: d.layers, + group: d.group, + normal: d.normal, + merge: d.merge, + }; + }); if (props.config.metricMode === "Expression") { queryServiceExpressions(currentServices); return;