datatrails: on histogram breakdowns, show label value in legend (#88154)

fix: on histogram breakdowns, show label value in legend
This commit is contained in:
Darren Janeczek
2024-05-24 15:41:00 -04:00
committed by GitHub
parent b5cf90ce78
commit a7d304a871
@@ -68,9 +68,16 @@ function heatMapQuery(groupings: string[] = []): PromQuery {
function percentileQuery(percentile: number, groupings: string[] = []) { function percentileQuery(percentile: number, groupings: string[] = []) {
const percent = percentile / 100; 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 { return {
refId: `Percentile${percentile}`, refId: `Percentile${percentile}`,
expr: `histogram_quantile(${percent}, ${baseQuery(groupings)})`, expr: `histogram_quantile(${percent}, ${baseQuery(groupings)})`,
legendFormat: `${percentile}th Percentile`, legendFormat,
}; };
} }