hydra-notify: support sending diagnostic dumps to STDERR on request

This commit is contained in:
Your Name
2021-08-18 15:42:03 -04:00
parent de2282bcf4
commit 45e8fa5319
2 changed files with 16 additions and 0 deletions

View File

@ -99,6 +99,7 @@ my $listener = Hydra::PostgresListener->new($dbh);
$listener->subscribe("build_started");
$listener->subscribe("build_finished");
$listener->subscribe("step_finished");
$listener->subscribe("hydra_notify_dump_metrics");
sub runPluginsForEvent {
my ($event) = @_;
@ -145,6 +146,11 @@ while (!$queued_only) {
$prom->inc("notify_event", { channel => $channelName });
if ($channelName eq "hydra_notify_dump_metrics") {
print STDERR "Dumping prometheus metrics:\n${\$prom->format}\n";
next;
}
eval {
my $event = Hydra::Event->new_event($channelName, $message->{"payload"});
runPluginsForEvent($event);