From 694dc60724c44e469b3f0b0a98273eb3066fa29d Mon Sep 17 00:00:00 2001 From: Ludovic Viaud Date: Thu, 8 Dec 2022 14:53:07 +0100 Subject: [PATCH] Prometheus: Add traceID field on top of the exemplar popover (#59920) Prioritize trace link --- .../app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx b/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx index 6d2e18a582b..8cb06f34c3e 100644 --- a/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx @@ -70,6 +70,10 @@ export const ExemplarMarker: React.FC = ({ }, [setIsOpen]); const renderMarker = useCallback(() => { + // Put the traceID field in front. + const traceIDField = dataFrame.fields.find((field) => field.name === 'traceID') || dataFrame.fields[0]; + const orderedDataFrameFields = [traceIDField, ...dataFrame.fields.filter((field) => traceIDField !== field)]; + const timeFormatter = (value: number) => { return dateTimeFormat(value, { format: systemDateFormats.fullDate, @@ -94,7 +98,7 @@ export const ExemplarMarker: React.FC = ({
- {dataFrame.fields.map((field, i) => { + {orderedDataFrameFields.map((field, i) => { const value = field.values.get(dataFrameFieldIndex.fieldIndex); const links = field.config.links?.length ? getFieldLinks(field, dataFrameFieldIndex.fieldIndex)