diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-12-30 16:27:51 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-12-30 16:27:51 +0100 |
commit | 59f844103dcab9de9e8c29941157bf1257cef5a6 (patch) | |
tree | 34b6704bfe58c6d230ea111bc09571e6329ec2f1 /lib/Travelynx/Command/work.pm | |
parent | ccc93413a28d03fd3d2ccf2d86831ad00c77cfe2 (diff) |
worker: optionally publish influxdb stats
Diffstat (limited to 'lib/Travelynx/Command/work.pm')
-rw-r--r-- | lib/Travelynx/Command/work.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index e12e5e3..6010fb5 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -249,6 +249,18 @@ sub run { } )->wait; } + + my $started_at = $now; + $now = DateTime->now( time_zone => 'Europe/Berlin' ); + + my $worker_duration = $now->epoch - $started_at->epoch; + + if ( $self->app->config->{influxdb}->{url} ) { + $self->app->ua->post_p( + $self->app->config->{influxdb}->{url}, + "worker duration_seconds=$worker_duration" + )->wait; + } } 1; |