-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ingest): various logging improvements #11126
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,6 +202,8 @@ def _write_done_callback( | |
record_urn = _get_urn(record_envelope) | ||
if record_urn: | ||
e.info["urn"] = record_urn | ||
if workunit_id := record_envelope.metadata.get("workunit_id"): | ||
e.info["workunit_id"] = workunit_id | ||
Comment on lines
+205
to
+206
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure metadata key existence before accessing. The code assumes the existence of the workunit_id = record_envelope.metadata.get("workunit_id")
if workunit_id:
e.info["workunit_id"] = workunit_id |
||
|
||
if not self.treat_errors_as_warnings: | ||
self.report.report_failure({"error": e.message, "info": e.info}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ | |
"acryl_datahub_cloud", | ||
] | ||
IN_MEMORY_LOG_BUFFER_SIZE = 2000 # lines | ||
IN_MEMORY_LOG_BUFFER_MAX_LINE_LENGTH = 2000 # characters | ||
|
||
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define Consider making IN_MEMORY_LOG_BUFFER_MAX_LINE_LENGTH = int(os.getenv("LOG_BUFFER_MAX_LINE_LENGTH", 2000)) |
||
|
||
NO_COLOR = os.environ.get("NO_COLOR", False) | ||
|
||
|
@@ -159,6 +161,9 @@ def __init__(self, maxlen: Optional[int] = None) -> None: | |
self._buffer: Deque[str] = collections.deque(maxlen=maxlen) | ||
|
||
def write(self, line: str) -> None: | ||
if len(line) > IN_MEMORY_LOG_BUFFER_MAX_LINE_LENGTH: | ||
line = line[:IN_MEMORY_LOG_BUFFER_MAX_LINE_LENGTH] + "[truncated]" | ||
|
||
self._buffer.append(line) | ||
|
||
def clear(self) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ayy python 3.8