Skip to content

Commit 1276f8c

Browse files
committed
Grouping ad hoc runs under alerting metrics
1 parent 03d7d5b commit 1276f8c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

x-pack/platform/plugins/shared/task_manager/server/metrics/lib/get_task_type_group.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ describe('getTaskTypeGroup', () => {
1313
expect(getTaskTypeGroup('actions:def')).toEqual('actions');
1414
});
1515

16+
test('should correctly group ad hoc runs under alerting', () => {
17+
expect(getTaskTypeGroup('ad_hoc_run-backfill')).toEqual('alerting');
18+
});
19+
1620
test('should return undefined if no match', () => {
1721
expect(getTaskTypeGroup('alerting-abc')).toBeUndefined();
1822
expect(getTaskTypeGroup('fooalertingbar')).toBeUndefined();

x-pack/platform/plugins/shared/task_manager/server/metrics/lib/get_task_type_group.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
* 2.0.
66
*/
77

8-
const taskTypeGrouping = new Set<string>(['alerting:', 'actions:']);
8+
const ALERT_GROUP = 'alerting';
9+
const ACTIONS_GROUP = 'actions';
10+
const taskTypeGrouping = new Set<string>([`${ALERT_GROUP}:`, `${ACTIONS_GROUP}:`]);
911

1012
export function getTaskTypeGroup(taskType: string): string | undefined {
13+
// we want to group ad hoc runs under alerting
14+
if (taskType === 'ad_hoc_run-backfill') {
15+
return ALERT_GROUP;
16+
}
17+
1118
for (const group of taskTypeGrouping) {
1219
if (taskType.startsWith(group)) {
1320
return group.replace(':', '');

0 commit comments

Comments
 (0)