Prometheus: Fix query builder visualization when a query has by() clause for quantile (#88480)

Prometheus query builder: add support for by() clause for quantile aggregation
This commit is contained in:
Yuri Kotov
2024-06-19 13:19:27 +07:00
committed by GitHub
parent 74bcfb284c
commit a5e02f033a
3 changed files with 8 additions and 6 deletions

View File

@@ -28,6 +28,10 @@ export function getAggregationOperations(): QueryBuilderOperationDef[] {
params: [{ name: 'Identifier', type: 'string' }], params: [{ name: 'Identifier', type: 'string' }],
defaultParams: ['count'], defaultParams: ['count'],
}), }),
...createAggregationOperationWithParam(PromOperationId.Quantile, {
params: [{ name: 'Value', type: 'number' }],
defaultParams: [1],
}),
createAggregationOverTime(PromOperationId.SumOverTime), createAggregationOverTime(PromOperationId.SumOverTime),
createAggregationOverTime(PromOperationId.AvgOverTime), createAggregationOverTime(PromOperationId.AvgOverTime),
createAggregationOverTime(PromOperationId.MinOverTime), createAggregationOverTime(PromOperationId.MinOverTime),

View File

@@ -76,6 +76,10 @@ export const generalTemplates: TemplateData[] = [
template: 'count_values("aaaa",metric_a{})', template: 'count_values("aaaa",metric_a{})',
description: 'Count number of label values for a label named "aaaa"', description: 'Count number of label values for a label named "aaaa"',
}, },
{
template: 'quantile by(l) (1,metric_a)',
description: 'Quantile of series in the metric "metric_a" grouped by the label "l"',
},
]; ];
export const counterTemplates: TemplateData[] = [ export const counterTemplates: TemplateData[] = [

View File

@@ -230,12 +230,6 @@ export function getOperationDefinitions(): QueryBuilderOperationDef[] {
id: PromOperationId.Pi, id: PromOperationId.Pi,
renderer: (model) => `${model.id}()`, renderer: (model) => `${model.id}()`,
}), }),
createFunction({
id: PromOperationId.Quantile,
params: [{ name: 'Value', type: 'number' }],
defaultParams: [1],
renderer: functionRendererLeft,
}),
createFunction({ id: PromOperationId.Rad }), createFunction({ id: PromOperationId.Rad }),
createRangeFunction(PromOperationId.Resets), createRangeFunction(PromOperationId.Resets),
createFunction({ createFunction({