From 7a1c83b5fb4558b412404441725c99dc25b8b5ba Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Thu, 24 Nov 2022 18:51:21 +0800 Subject: [PATCH] fix: update metric processor for the `readRecords` and remove `readSampledRecords` from metrics selector (#191) --- src/hooks/useMetricsProcessor.ts | 9 +++++++-- src/views/dashboard/data.ts | 5 +---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hooks/useMetricsProcessor.ts b/src/hooks/useMetricsProcessor.ts index 54dc3a19..979d9507 100644 --- a/src/hooks/useMetricsProcessor.ts +++ b/src/hooks/useMetricsProcessor.ts @@ -213,8 +213,13 @@ export function useSourceProcessor( source[m] = aggregation(Number(Object.values(resp.data)[0]), c); } if ( - type === MetricQueryTypes.SortMetrics || - type === MetricQueryTypes.ReadSampledRecords + ( + [ + MetricQueryTypes.ReadRecords, + MetricQueryTypes.ReadSampledRecords, + MetricQueryTypes.SortMetrics, + ] as string[] + ).includes(type) ) { source[m] = (Object.values(resp.data)[0] || []).map( (d: { value: unknown; name: string }) => { diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts index 534aeea6..c1edb5af 100644 --- a/src/views/dashboard/data.ts +++ b/src/views/dashboard/data.ts @@ -134,10 +134,7 @@ export const MetricTypes: { HEATMAP: [ { label: "read heatmap values in the duration", value: "readHeatMap" }, ], - SAMPLED_RECORD: [ - { label: "get sorted topN values", value: "readRecords" }, - { label: "get sorted topN values", value: "readSampledRecords" }, - ], + SAMPLED_RECORD: [{ label: "get sorted topN values", value: "readRecords" }], }; export enum MetricCatalog {