@@ -69,6 +69,12 @@ def from_results(cls, results: Iterable[TriggerResult]) -> "EvaluationStats":
6969 untainted += 1
7070 return cls (tainted = tainted , untainted = untainted )
7171
72+ def __add__ (self , other : "EvaluationStats" ) -> "EvaluationStats" :
73+ return EvaluationStats (
74+ tainted = self .tainted + other .tainted ,
75+ untainted = self .untainted + other .untainted ,
76+ )
77+
7278 def report_metrics (self , metric_name : str ) -> None :
7379 metrics_incr (metric_name , self .tainted , tags = {"tainted" : True })
7480 metrics_incr (metric_name , self .untainted , tags = {"tainted" : False })
@@ -567,11 +573,11 @@ def process_workflows(
567573 triggered_workflows , queue_items_by_workflow_id , trigger_stats = evaluate_workflow_triggers (
568574 workflows , event_data , event_start_time
569575 )
570- trigger_stats .report_metrics ("process_workflows.workflows_evaluated" )
571576
572577 workflow_evaluation_data .triggered_workflows = set (triggered_workflows .keys ())
573578
574579 if not triggered_workflows and not queue_items_by_workflow_id :
580+ trigger_stats .report_metrics ("process_workflows.workflows_evaluated" )
575581 # TODO - re-think tainted once the actions are removed from process_workflows.
576582 return WorkflowEvaluation (
577583 tainted = True ,
@@ -586,7 +592,7 @@ def process_workflows(
586592 triggered_workflows , event_data , queue_items_by_workflow_id , event_start_time
587593 )
588594 )
589- action_stats .report_metrics ("process_workflows.workflows_evaluated" )
595+ ( trigger_stats + action_stats ) .report_metrics ("process_workflows.workflows_evaluated" )
590596
591597 enqueue_workflows (batch_client , queue_items_by_workflow_id )
592598
0 commit comments