diff --git a/lib/Travelynx/Command/influxdb.pm b/lib/Travelynx/Command/influxdb.pm index 5767a004b4b3c46913561f0c42c6a4b987d3be9c..1ad0d6c7781032f14ca696fe3918c6c9689414bb 100644 --- a/lib/Travelynx/Command/influxdb.pm +++ b/lib/Travelynx/Command/influxdb.pm @@ -29,6 +29,7 @@ sub run { my $active = $now->clone->subtract( months => 1 ); my @stats; + my @stations; my @traewelling; push( @@ -83,6 +84,44 @@ sub run { $db->select( 'polylines', 'count(*) as count' )->hash->{count} ) ); + + push( + @stations, + query_to_influx( + 'iris', + $db->select( + 'stations', + 'count(*) as count', + { + source => 0, + archived => 0 + } + )->hash->{count} + ) + ); + push( + @stations, + query_to_influx( + 'hafas', + $db->select( + 'stations', + 'count(*) as count', + { + source => 1, + archived => 0 + } + )->hash->{count} + ) + ); + push( + @stations, + query_to_influx( + 'archived', + $db->select( 'stations', 'count(*) as count', { archived => 1 } ) + ->hash->{count} + ) + ); + push( @traewelling, query_to_influx( @@ -115,11 +154,29 @@ sub run { ) ); - if ( $self->app->config->{influxdb}->{url} ) { + if ( $self->app->mode eq 'development' ) { + $self->app->log->debug( 'POST ' + . $self->app->config->{influxdb}->{url} + . ' stats ' + . join( ',', @stats ) ); + $self->app->log->debug( 'POST ' + . $self->app->config->{influxdb}->{url} + . ' stations ' + . join( ',', @stations ) ); + $self->app->log->debug( 'POST ' + . $self->app->config->{influxdb}->{url} + . ' traewelling ' + . join( ',', @traewelling ) ); + } + elsif ( $self->app->config->{influxdb}->{url} ) { $self->app->ua->post_p( $self->app->config->{influxdb}->{url}, 'stats ' . join( ',', @stats ) )->wait; + $self->app->ua->post_p( + $self->app->config->{influxdb}->{url}, + 'stations ' . join( ',', @stations ) + )->wait; $self->app->ua->post_p( $self->app->config->{influxdb}->{url}, 'traewelling ' . join( ',', @traewelling ) diff --git a/templates/_departures_hafas.html.ep b/templates/_departures_hafas.html.ep index 5b1a057833435c8429b17f92db52894e82230b0d..123f14b4da85d3598815c711e80326ee9c03b2ec 100644 --- a/templates/_departures_hafas.html.ep +++ b/templates/_departures_hafas.html.ep @@ -1,3 +1,4 @@ +
+++ Testbetrieb +++