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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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