Skip to content

Commit

Permalink
Log traceback only on DEBUG for KPO logs read interruption (#22595)
Browse files Browse the repository at this point in the history
Logging the traceback after every disconnect is a little overly scary when this is an expected occurrence for long-running pods, and this can create false alarm for users.  Here we reduce noise a bit while allowing users to troubleshoot if desired by changing the log level to debug.

GitOrigin-RevId: 67e2723b7364ce1f73aee801522693d12d615310
  • Loading branch information
dstandish authored and Cloud Composer Team committed Sep 18, 2024
1 parent ced9ec8 commit 6cde9db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions airflow/providers/cncf/kubernetes/utils/pod_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,14 @@ def consume_logs(*, since_time: Optional[DateTime] = None, follow: bool = True)
for line in logs:
timestamp, message = self.parse_log_line(line.decode('utf-8'))
self.log.info(message)
except BaseHTTPError: # Catches errors like ProtocolError(TimeoutError).
except BaseHTTPError as e:
self.log.warning(
'Failed to read logs for pod %s',
"Reading of logs interrupted with error %r; will retry. "
"Set log level to DEBUG for traceback.",
e,
)
self.log.debug(
"Traceback for interrupted logs read for pod %r",
pod.metadata.name,
exc_info=True,
)
Expand Down

0 comments on commit 6cde9db

Please sign in to comment.