Skip to content

Commit 4da8361

Browse files
committed
Add more CPU usage measurement logs
1 parent 2e85e3b commit 4da8361

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/crawlee/_autoscaling/system_status.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def _is_cpu_overloaded(self, sample_duration: timedelta | None = None) -> LoadRa
123123
CPU load ratio information.
124124
"""
125125
sample = self._snapshotter.get_cpu_sample(sample_duration)
126+
logger.info(sample)
126127
return self._is_sample_overloaded(sample, self._cpu_overload_threshold)
127128

128129
def _is_memory_overloaded(self, sample_duration: timedelta | None = None) -> LoadRatioInfo:

src/crawlee/_log_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import sys
66
import textwrap
7+
from datetime import datetime
78
from typing import TYPE_CHECKING, Any
89

910
from colorama import Fore, Style, just_fix_windows_console
@@ -162,6 +163,6 @@ def format(self, record: logging.LogRecord) -> str:
162163

163164
if self.include_logger_name:
164165
# Include logger name at the beginning of the log line
165-
return f'{logger_name_string}{level_string}{log_string}{extra_string}{exception_string}'
166+
return f'{datetime.utcnow().strftime("%M-%S-%f")}{logger_name_string}{level_string}{log_string}{extra_string}{exception_string}'
166167

167168
return f'{level_string}{log_string}{extra_string}{exception_string}'

0 commit comments

Comments
 (0)