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, }; }