From d2bdafd5976cfadb67698545e0d578e4c8c77686 Mon Sep 17 00:00:00 2001 From: Matthew Heidemann Date: Wed, 4 Sep 2024 08:20:07 -0600 Subject: [PATCH] Updated note --- src/preprocessors/timeseries.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/preprocessors/timeseries.ts b/src/preprocessors/timeseries.ts index 5702a46..c685cc5 100644 --- a/src/preprocessors/timeseries.ts +++ b/src/preprocessors/timeseries.ts @@ -139,8 +139,9 @@ export function createTimestampMap(timestamps: number[]): Map { return timestampToIndexMap; } -// TODO: remove when Grafana 10 is the minimum supported version function legenedFormatter(legend = "", labels: Labels) { + // nb: We're slightly divergent from `renderLegendFormat` available in v10+ + // since they just repeat the key if a label value is undefined const aliasRegex = /\{\{\s*(.+?)\s*\}\}/g; return legend.replace(aliasRegex, (_, group) => (labels[group] ? labels[group] : "")); }