From a7d304a871c32e5cfed27e8986e8b2a5fefa3fed Mon Sep 17 00:00:00 2001 From: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com> Date: Fri, 24 May 2024 15:41:00 -0400 Subject: [PATCH] datatrails: on histogram breakdowns, show label value in legend (#88154) fix: on histogram breakdowns, show label value in legend --- .../AutomaticMetricQueries/query-generators/histogram.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/app/features/trails/AutomaticMetricQueries/query-generators/histogram.ts b/public/app/features/trails/AutomaticMetricQueries/query-generators/histogram.ts index b6fc3903c1f..e6e4644bb15 100644 --- a/public/app/features/trails/AutomaticMetricQueries/query-generators/histogram.ts +++ b/public/app/features/trails/AutomaticMetricQueries/query-generators/histogram.ts @@ -68,9 +68,16 @@ function heatMapQuery(groupings: string[] = []): PromQuery { function percentileQuery(percentile: number, groupings: string[] = []) { const percent = percentile / 100; + let legendFormat = `${percentile}th Percentile`; + + // For the breakdown view, show the label value variable we are grouping by + if (groupings[0]) { + legendFormat = `{{${groupings[0]}}}`; + } + return { refId: `Percentile${percentile}`, expr: `histogram_quantile(${percent}, ${baseQuery(groupings)})`, - legendFormat: `${percentile}th Percentile`, + legendFormat, }; }