Prometheus: Add group function to aggregations (#91363)
add group function to aggregations
This commit is contained in:
@@ -16,6 +16,7 @@ export function getAggregationOperations(): QueryBuilderOperationDef[] {
|
||||
...createAggregationOperation(PromOperationId.Min),
|
||||
...createAggregationOperation(PromOperationId.Max),
|
||||
...createAggregationOperation(PromOperationId.Count),
|
||||
...createAggregationOperation(PromOperationId.Group),
|
||||
...createAggregationOperationWithParam(PromOperationId.TopK, {
|
||||
params: [{ name: 'K-value', type: 'number' }],
|
||||
defaultParams: [5],
|
||||
|
||||
@@ -195,7 +195,6 @@ export function getOperationDefinitions(): QueryBuilderOperationDef[] {
|
||||
//
|
||||
createFunction({ id: PromOperationId.Exp }),
|
||||
createFunction({ id: PromOperationId.Floor }),
|
||||
createFunction({ id: PromOperationId.Group }),
|
||||
createFunction({ id: PromOperationId.Hour }),
|
||||
createFunction({
|
||||
id: PromOperationId.LabelJoin,
|
||||
|
||||
@@ -783,6 +783,21 @@ describe('buildVisualQueryFromString', () => {
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('parses the group function as an aggregation', () => {
|
||||
expect(buildVisualQueryFromString('group by (job) (go_goroutines)')).toEqual(
|
||||
noErrors({
|
||||
metric: 'go_goroutines',
|
||||
labels: [],
|
||||
operations: [
|
||||
{
|
||||
id: '__group_by',
|
||||
params: ['job'],
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function noErrors(query: PromVisualQuery) {
|
||||
|
||||
Reference in New Issue
Block a user