@@ -39,7 +39,7 @@ import { IEvent, IEventLogger, SAVED_OBJECT_REL_PRIMARY } from '../../../event_l
39
39
import { isAlertSavedObjectNotFoundError } from '../lib/is_alert_not_found_error' ;
40
40
import { AlertsClient } from '../alerts_client' ;
41
41
import { partiallyUpdateAlert } from '../saved_objects' ;
42
- import { ResolvedActionGroup } from '../../common' ;
42
+ import { RecoveredActionGroup } from '../../common' ;
43
43
44
44
const FALLBACK_RETRY_INTERVAL = '5m' ;
45
45
@@ -219,7 +219,7 @@ export class TaskRunner {
219
219
alertInstance . hasScheduledActions ( )
220
220
) ;
221
221
222
- generateNewAndResolvedInstanceEvents ( {
222
+ generateNewAndRecoveredInstanceEvents ( {
223
223
eventLogger,
224
224
originalAlertInstances,
225
225
currentAlertInstances : instancesWithScheduledActions ,
@@ -229,7 +229,7 @@ export class TaskRunner {
229
229
} ) ;
230
230
231
231
if ( ! muteAll ) {
232
- scheduleActionsForResolvedInstances (
232
+ scheduleActionsForRecoveredInstances (
233
233
alertInstances ,
234
234
executionHandler ,
235
235
originalAlertInstances ,
@@ -436,7 +436,7 @@ export class TaskRunner {
436
436
}
437
437
}
438
438
439
- interface GenerateNewAndResolvedInstanceEventsParams {
439
+ interface GenerateNewAndRecoveredInstanceEventsParams {
440
440
eventLogger : IEventLogger ;
441
441
originalAlertInstances : Dictionary < AlertInstance > ;
442
442
currentAlertInstances : Dictionary < AlertInstance > ;
@@ -445,18 +445,20 @@ interface GenerateNewAndResolvedInstanceEventsParams {
445
445
namespace : string | undefined ;
446
446
}
447
447
448
- function generateNewAndResolvedInstanceEvents ( params : GenerateNewAndResolvedInstanceEventsParams ) {
448
+ function generateNewAndRecoveredInstanceEvents (
449
+ params : GenerateNewAndRecoveredInstanceEventsParams
450
+ ) {
449
451
const { eventLogger, alertId, namespace, currentAlertInstances, originalAlertInstances } = params ;
450
452
const originalAlertInstanceIds = Object . keys ( originalAlertInstances ) ;
451
453
const currentAlertInstanceIds = Object . keys ( currentAlertInstances ) ;
452
454
453
455
const newIds = without ( currentAlertInstanceIds , ...originalAlertInstanceIds ) ;
454
- const resolvedIds = without ( originalAlertInstanceIds , ...currentAlertInstanceIds ) ;
456
+ const recoveredIds = without ( originalAlertInstanceIds , ...currentAlertInstanceIds ) ;
455
457
456
- for ( const id of resolvedIds ) {
458
+ for ( const id of recoveredIds ) {
457
459
const actionGroup = originalAlertInstances [ id ] . getLastScheduledActions ( ) ?. group ;
458
- const message = `${ params . alertLabel } resolved instance: '${ id } '` ;
459
- logInstanceEvent ( id , EVENT_LOG_ACTIONS . resolvedInstance , message , actionGroup ) ;
460
+ const message = `${ params . alertLabel } instance '${ id } ' has recovered ` ;
461
+ logInstanceEvent ( id , EVENT_LOG_ACTIONS . recoveredInstance , message , actionGroup ) ;
460
462
}
461
463
462
464
for ( const id of newIds ) {
@@ -496,7 +498,7 @@ function generateNewAndResolvedInstanceEvents(params: GenerateNewAndResolvedInst
496
498
}
497
499
}
498
500
499
- function scheduleActionsForResolvedInstances (
501
+ function scheduleActionsForRecoveredInstances (
500
502
alertInstancesMap : Record < string , AlertInstance > ,
501
503
executionHandler : ReturnType < typeof createExecutionHandler > ,
502
504
originalAlertInstances : Record < string , AlertInstance > ,
@@ -505,22 +507,22 @@ function scheduleActionsForResolvedInstances(
505
507
) {
506
508
const currentAlertInstanceIds = Object . keys ( currentAlertInstances ) ;
507
509
const originalAlertInstanceIds = Object . keys ( originalAlertInstances ) ;
508
- const resolvedIds = without (
510
+ const recoveredIds = without (
509
511
originalAlertInstanceIds ,
510
512
...currentAlertInstanceIds ,
511
513
...mutedInstanceIds
512
514
) ;
513
- for ( const id of resolvedIds ) {
515
+ for ( const id of recoveredIds ) {
514
516
const instance = alertInstancesMap [ id ] ;
515
- instance . updateLastScheduledActions ( ResolvedActionGroup . id ) ;
517
+ instance . updateLastScheduledActions ( RecoveredActionGroup . id ) ;
516
518
instance . unscheduleActions ( ) ;
517
519
executionHandler ( {
518
- actionGroup : ResolvedActionGroup . id ,
520
+ actionGroup : RecoveredActionGroup . id ,
519
521
context : { } ,
520
522
state : { } ,
521
523
alertInstanceId : id ,
522
524
} ) ;
523
- instance . scheduleActions ( ResolvedActionGroup . id ) ;
525
+ instance . scheduleActions ( RecoveredActionGroup . id ) ;
524
526
}
525
527
}
526
528
0 commit comments