Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Show Request ID and hide Trace ID (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 authored May 20, 2024
1 parent d227b3d commit 4877390
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions cads_api_client/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def error_json_to_message(error_json: dict[str, Any]) -> str:
for key in ("title", "traceback", "detail")
if key in error_json
]
if trace_id := error_json.get("trace_id"):
error_messages.append(f"Trace ID is {trace_id}")
return "\n".join(error_messages)


Expand Down Expand Up @@ -187,7 +185,7 @@ def __init__(
self.headers = headers
self.session = session
self.log_start_time = None
logger.debug(f"Request UID is {self.request_uid}")
logger.info(f"Request ID is {self.request_uid}")

def log_metadata(self, metadata: dict[str, Any]) -> None:
logs = metadata.get("log", [])
Expand Down
6 changes: 3 additions & 3 deletions tests/test_10_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def test_wait_on_result_failed() -> None:
remote = collection.submit(variable="temperature", year="0000")
with pytest.raises(
cads_api_client.processing.ProcessingFailedError,
match="job failed\nThis is a traceback\nTrace ID is ca3e7170-1ce2-48fc-97f8-bbe64fafce44",
match="job failed\nThis is a traceback",
):
remote.wait_on_result()

Expand Down Expand Up @@ -476,8 +476,8 @@ def test_remote_logs(caplog: pytest.LogCaptureFixture) -> None:
),
(
"cads_api_client.processing",
10,
"Request UID is 9bfc1362-2832-48e1-a235-359267420bb2",
20,
"Request ID is 9bfc1362-2832-48e1-a235-359267420bb2",
),
(
"cads_api_client.processing",
Expand Down

0 comments on commit 4877390

Please sign in to comment.