Lower service rate limit log level to INFO

Services reaching rate limits are triggering our alerts and make it
hard to find actual exceptions in the logs.

As far as the API is concerned this is not an exceptional state,
so we shouldn't log it as such.
This commit is contained in:
Alexey Bezhan
2018-11-27 15:50:51 +00:00
parent e7a2f4c151
commit 462c8db4c3

View File

@@ -29,7 +29,7 @@ def check_service_over_api_rate_limit(service, api_key):
rate_limit = service.rate_limit
interval = 60
if redis_store.exceeded_rate_limit(cache_key, rate_limit, interval):
current_app.logger.error("service {} has been rate limited for throughput".format(service.id))
current_app.logger.info("service {} has been rate limited for throughput".format(service.id))
raise RateLimitError(rate_limit, interval, api_key.key_type)
@@ -41,7 +41,7 @@ def check_service_over_daily_message_limit(key_type, service):
service_stats = services_dao.fetch_todays_total_message_count(service.id)
redis_store.set(cache_key, service_stats, ex=3600)
if int(service_stats) >= service.message_limit:
current_app.logger.error(
current_app.logger.info(
"service {} has been rate limited for daily use sent {} limit {}".format(
service.id, int(service_stats), service.message_limit)
)