hydra-notify: initial scratch take of prometheus events

[?]
Aug 18, 2021, 6:08 PM
I7DFJWL64QNNEZVTYQYJO2YI6NYKMWXXBV2TG6G3YAVID5ANPZ2AC

Dependencies

  • [2] QEXFA5Y2 hydra-notify: use Hydra::Event
  • [3] M2JQG2SN Flake: add perlcritic deps
  • [4] 3AKZKWCR RunCommand: Test
  • [5] 32KJOERM Turn hydra-notify into a daemon
  • [6] P4SME2BC Abstract over postgres' LISTEN/NOTIFY
  • [7] 4ZCUCACY hydra-notify: Fix processing notifications
  • [8] WYELTQMO Separate payload elements using \t
  • [*] RWNXH3H2 lastModified -> lastModifiedDate
  • [*] IE2PRAQU hydra-queue-runner: Send build notifications
  • [*] FN3QFV6V hydra-notify: Create a helper for running each plugin on an event
  • [*] CQZQE32V Improve handling of Perl's block eval errors

Change contents

  • edit in flake.nix at line 473
    [10.2514]
    [3.3060]
    ParallelForkManager
  • edit in src/script/hydra-notify at line 6
    [2.18]
    [2.18]
    use HTTP::Server::PSGI;
  • edit in src/script/hydra-notify at line 13
    [4.1752]
    [11.3128]
    use Parallel::ForkManager;
    use Prometheus::Tiny::Shared;
    use Time::HiRes qw( gettimeofday tv_interval );
    my $prom = Prometheus::Tiny::Shared->new;
    my $fork_manager = Parallel::ForkManager->new(1 );
    $fork_manager->start_child("metrics_exporter", sub {
    my $server = HTTP::Server::PSGI->new(
    host => "127.0.0.1",
    port => 9091,
    timeout => 5,
    );
  • edit in src/script/hydra-notify at line 27
    [11.3129]
    [11.3129]
    $server->run($prom->psgi);
    });
  • edit in src/script/hydra-notify at line 55
    [12.48]
    [4.1591]
    my $channelName = $event->{'channel_name'};
  • edit in src/script/hydra-notify at line 59
    [12.85]
    [12.85]
    $prom->inc("notify_plugin_executions", { channel => $channelName, plugin => ref $plugin });
  • edit in src/script/hydra-notify at line 61
    [12.100]
    [12.100]
    my $startTime = [gettimeofday()];
  • edit in src/script/hydra-notify at line 63
    [12.143]
    [12.143]
    $prom->histogram_observe("notify_plugin_runtime", tv_interval($startTime), { channel => $channelName, plugin => ref $plugin });
    $prom->inc("notify_plugin_success", { channel => $channelName, plugin => ref $plugin });
  • edit in src/script/hydra-notify at line 68
    [12.176]
    [12.176]
    $prom->inc("notify_plugin_error", { channel => $channelName, plugin => ref $plugin });
  • edit in src/script/hydra-notify at line 88
    [4.125]
    [4.1923]
    $prom->inc("event_loop_iterations");
  • replacement in src/script/hydra-notify at line 91
    [4.53][4.2904:2905](),[4.2017][4.2904:2905](),[4.2904][4.2904:2905]()
    [4.2017]
    [4.2018]
    $prom->set("event_received", time());
  • edit in src/script/hydra-notify at line 96
    [4.2945]
    [4.220]
    $prom->inc("notify_event", { channel => $channelName });
  • edit in src/script/hydra-notify at line 104
    [13.1235]
    [4.798]
    $prom->inc("notify_event_error", { channel => $channelName });