From a86e8136c92979c3d59884ca164a182b323b3481 Mon Sep 17 00:00:00 2001 From: Ramneet Chopra Date: Thu, 15 Sep 2022 09:57:06 +0000 Subject: [PATCH] alias handling for metric label Signed-off-by: Ramneet Chopra --- dashboards-observability/common/types/explorer.ts | 1 + .../public/components/visualizations/charts/stats/stats.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dashboards-observability/common/types/explorer.ts b/dashboards-observability/common/types/explorer.ts index 1342826a4..682cec360 100644 --- a/dashboards-observability/common/types/explorer.ts +++ b/dashboards-observability/common/types/explorer.ts @@ -264,6 +264,7 @@ export interface ConfigListEntry { name: string; side: string; type: string; + alias?: string; } export interface HistogramConfigList { diff --git a/dashboards-observability/public/components/visualizations/charts/stats/stats.tsx b/dashboards-observability/public/components/visualizations/charts/stats/stats.tsx index e6f6229b5..f67c5083a 100644 --- a/dashboards-observability/public/components/visualizations/charts/stats/stats.tsx +++ b/dashboards-observability/public/components/visualizations/charts/stats/stats.tsx @@ -286,7 +286,9 @@ export const Stats = ({ visualizations, layout, config }: any) => { const generateLineTraces = () => { return metrics.map((metric: ConfigListEntry, metricIndex: number) => { - const metricLabel = `${metric.aggregation}(${metric.name})`; + const metricLabel = `${ + metric.alias ? metric.alias : `${metric.aggregation}(${metric.name})` + }`; const isLabelExisted = queriedVizData[metricLabel] ? true : false; const annotationOption = { label: metricLabel,