diff --git a/src/ota_proxy/lru_cache_helper.py b/src/ota_proxy/lru_cache_helper.py index 8772e14d5..fcf77bb1d 100644 --- a/src/ota_proxy/lru_cache_helper.py +++ b/src/ota_proxy/lru_cache_helper.py @@ -17,27 +17,17 @@ from __future__ import annotations import bisect -import logging import sqlite3 import time from pathlib import Path from simple_sqlite3_orm import utils -from otaclient_common.logging import BurstSuppressFilter +from otaclient_common.logging import get_burst_suppressed_logger from .db import AsyncCacheMetaORM, CacheMeta -burst_suppressed_logger = logging.getLogger(f"{__name__}.db_error") -# NOTE: for request_error, only allow max 6 lines of logging per 30 seconds -burst_suppressed_logger.addFilter( - BurstSuppressFilter( - f"{__name__}.db_error", - upper_logger_name=__name__, - burst_round_length=30, - burst_max=6, - ) -) +burst_suppressed_logger = get_burst_suppressed_logger(f"{__name__}.db_error") class LRUCacheHelper: diff --git a/src/ota_proxy/server_app.py b/src/ota_proxy/server_app.py index bd1999a00..6d43b16fb 100644 --- a/src/ota_proxy/server_app.py +++ b/src/ota_proxy/server_app.py @@ -23,7 +23,7 @@ import aiohttp from multidict import CIMultiDict, CIMultiDictProxy -from otaclient_common.logging import BurstSuppressFilter +from otaclient_common.logging import get_burst_suppressed_logger from ._consts import ( BHEADER_AUTHORIZATION, @@ -46,16 +46,8 @@ from .ota_cache import OTACache logger = logging.getLogger(__name__) -burst_suppressed_logger = logging.getLogger(f"{__name__}.request_error") # NOTE: for request_error, only allow max 6 lines of logging per 30 seconds -burst_suppressed_logger.addFilter( - BurstSuppressFilter( - f"{__name__}.request_error", - upper_logger_name=__name__, - burst_round_length=30, - burst_max=6, - ) -) +burst_suppressed_logger = get_burst_suppressed_logger(f"{__name__}.request_error") # only expose app __all__ = ("App",)