diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-03-30 13:04:00 +0200 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-03-30 13:04:00 +0200 | 
| commit | b841b9a177eaf94a66ff9e46530eacb7a5f60c83 (patch) | |
| tree | b89bf0a86364f6eb42f5df90cade9e7b8b7465c7 /lib/Travelynx | |
| parent | ee7c02aa5ffebe918280f5b28d366783a6de3dca (diff) | |
log API rate limit events to influxdb2.11.10
Diffstat (limited to 'lib/Travelynx')
| -rw-r--r-- | lib/Travelynx/Command/work.pm | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index 259043f..00dc27e 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -36,6 +36,7 @@ sub run {  	}  	my $errors             = 0; +	my $rate_limit_counts  = 0;  	my $dbris_rate_limited = 0;  	for my $entry ( $self->app->in_transit->get_all_active ) { @@ -141,6 +142,7 @@ sub run {  						);  						if ( $err =~ m{HTTP 429} ) {  							$dbris_rate_limited = 1; +							$rate_limit_counts += 1;  						}  					}  				)->wait; @@ -492,13 +494,13 @@ sub run {  		if ( $self->app->mode eq 'development' ) {  			$self->app->log->debug( 'POST '  				  . $self->app->config->{influxdb}->{url} -				  . " worker runtime_seconds=${worker_duration},errors=${errors}" +				  . " worker runtime_seconds=${worker_duration},errors=${errors},ratelimit_count=${rate_limit_counts}"  			);  		}  		else {  			$self->app->ua->post_p( $self->app->config->{influxdb}->{url}, -				"worker runtime_seconds=${worker_duration},errors=${errors}" ) -			  ->wait; +"worker runtime_seconds=${worker_duration},errors=${errors},ratelimit_count=${rate_limit_counts}" +			)->wait;  		}  	} | 
