Skip to content

Commit

Permalink
otaclient: use get_burst_suppressed_logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Dec 25, 2024
1 parent e376f36 commit d6a08df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
14 changes: 3 additions & 11 deletions src/otaclient/_status_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,11 @@
UpdateTiming,
)
from otaclient._utils import SharedOTAClientStatusWriter
from otaclient_common.logging import BurstSuppressFilter
from otaclient_common.logging import get_burst_suppressed_logger

logger = logging.getLogger(__name__)
burst_suppressed_logger = logging.getLogger(f"{__name__}.shm_push")
# NOTE: for request_error, only allow max 6 lines of logging per 30 seconds
burst_suppressed_logger.addFilter(
BurstSuppressFilter(
f"{__name__}.shm_push",
upper_logger_name=__name__,
burst_round_length=30,
burst_max=6,
)
)
# NOTE: suppress error logging for pushing OTA status to shm
burst_suppressed_logger = get_burst_suppressed_logger(f"{__name__}.shm_push")

_status_report_queue: queue.Queue | None = None

Expand Down
14 changes: 3 additions & 11 deletions src/otaclient/grpc/api_v2/ecu_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@
from otaclient.grpc.api_v2.ecu_status import ECUStatusStorage
from otaclient_api.v2 import types as api_types
from otaclient_api.v2.api_caller import ECUNoResponse, OTAClientCall
from otaclient_common.logging import BurstSuppressFilter
from otaclient_common.logging import get_burst_suppressed_logger

logger = logging.getLogger(__name__)
burst_suppressed_logger = logging.getLogger(f"{__name__}.local_ecu_check")
# NOTE: for request_error, only allow max 6 lines of logging per 30 seconds
burst_suppressed_logger.addFilter(
BurstSuppressFilter(
f"{__name__}.local_ecu_check",
upper_logger_name=__name__,
burst_round_length=30,
burst_max=6,
)
)
# NOTE: suppress error loggings from checking local ECU's status shm
burst_suppressed_logger = get_burst_suppressed_logger(f"{__name__}.local_ecu_check")

# actively polling ECUs status until we get the first valid response
# when otaclient is just starting.
Expand Down

0 comments on commit d6a08df

Please sign in to comment.