private void _processNotification ( Alert alert , History history , List < Metric > metrics , Map < BigInteger , Map < Metric , Long > > triggerFiredTimesAndMetricsByTrigger , Notification notification , Long alertEnqueueTimestamp ) { //refocus notifier does not need cool down logic, and every evaluation needs to send notification boolean isRefocusNotifier = SupportedNotifier . REFOCUS . getName ( ) . equals ( notification . getNotifierName ( ) ) ; for ( Trigger trigger : notification . getTriggers ( ) ) { Map < Metric , Long > triggerFiredTimesForMetrics = triggerFiredTimesAndMetricsByTrigger . get ( trigger . getId ( ) ) ; for ( Metric m : metrics ) { if ( triggerFiredTimesForMetrics != null && triggerFiredTimesForMetrics . containsKey ( m ) ) { String logMessage = MessageFormat . format ( "The trigger {0} was evaluated against metric {1} and it is fired." , trigger . getName ( ) , m . getIdentifier ( ) ) ; history . appendMessageNUpdateHistory ( logMessage , null , 0 ) ; if ( isRefocusNotifier ) { sendNotification ( trigger , m , history , notification , alert , triggerFiredTimesForMetrics . get ( m ) , alertEnqueueTimestamp ) ; continue ; } if ( ! notification . onCooldown ( trigger , m ) ) { _updateNotificationSetActiveStatus ( trigger , m , history , notification ) ; sendNotification ( trigger , m , history , notification , alert , triggerFiredTimesForMetrics . get ( m ) , alertEnqueueTimestamp ) ; } else { logMessage = MessageFormat . format ( "The notification {0} is on cooldown until {1}." , notification . getName ( ) , getDateMMDDYYYY ( notification . getCooldownExpirationByTriggerAndMetric ( trigger , m ) ) ) ; history . appendMessageNUpdateHistory ( logMessage , null , 0 ) ; } } else { String logMessage = MessageFormat . format ( "The trigger {0} was evaluated against metric {1} and it is not fired." , trigger . getName ( ) , m . getIdentifier ( ) ) ; history . appendMessageNUpdateHistory ( logMessage , null , 0 ) ; if ( isRefocusNotifier ) { sendClearNotification ( trigger , m , history , notification , alert , alertEnqueueTimestamp ) ; continue ; } if ( notification . isActiveForTriggerAndMetric ( trigger , m ) ) { // This is case when the notification was active for the given trigger, metric combination // and the metric did not violate triggering condition on current evaluation. Hence we must clear it. _updateNotificationClearActiveStatus ( trigger , m , notification ) ; sendClearNotification ( trigger , m , history , notification , alert , alertEnqueueTimestamp ) ; } } } } }
Evaluates all triggers associated with the notification and updates the job history .