Tasks: only execute the event if the plugin is interested in it

This commit is contained in:
Graham Christensen
2021-12-20 13:27:59 -05:00
parent 633fc36d6a
commit a14501c616
12 changed files with 150 additions and 21 deletions

View File

@@ -117,6 +117,11 @@ sub new {
type => "counter",
help => "Number of tasks that have not been processed because the plugin does not exist."
);
$prometheus->declare(
"notify_plugin_not_interested",
type => "counter",
help => "Number of tasks that have not been processed because the plugin was not interested in the event."
);
my %plugins_by_name = map { ref $_ => $_ } @{$plugins};
@@ -190,6 +195,11 @@ sub dispatch_task {
return 0;
}
if (!$task->{"event"}->interested($plugin)) {
$self->{"prometheus"}->inc("notify_plugin_not_interested", $event_labels);
return 0;
}
$self->{"prometheus"}->inc("notify_plugin_executions", $event_labels);
eval {
my $start_time = [gettimeofday()];