Skip to content

Backend chat observability upgrade: standardized request summary logs#146

Closed
akgohain wants to merge 1 commit intomainfrom
codex/standardize-logging-for-chat-endpoints
Closed

Backend chat observability upgrade: standardized request summary logs#146
akgohain wants to merge 1 commit intomainfrom
codex/standardize-logging-for-chat-endpoints

Conversation

@akgohain
Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a concise, structured single-line summary for chat/helper endpoints to speed diagnosis of stalls and failures.
  • Ensure every request summary includes request_id, endpoint, latency_ms, status, and error_type while preserving existing verbose logs.
  • Avoid leaking sensitive request payloads in summary logs.

Description

  • Added a shared logging utility server_api/chatbot/logging_utils.py exposing request_id_from_request and log_request_summary that emits a standardized one-line summary with the required fields.
  • Integrated summary logging into chat endpoints in server_api/main.py (/chat/query, /chat/clear, /chat/status, /chat/helper/query, /chat/helper/clear) capturing start time, status (ok/error), and error type without logging request bodies.
  • Kept original endpoint behavior and persistence logic unchanged while adding try/except/finally around processing to ensure the summary is always emitted.
  • Changes implemented on branch agent/chat-observability-upgrade and include a new test file tests/test_chat_logging_fields.py.

Testing

  • Added tests/test_chat_logging_fields.py which asserts presence of request_id, endpoint, latency_ms, status, and error_type in summary logs and verifies sensitive payload text is not present.
  • Attempted environment uv run pytest -q tests/test_chat_logging_fields.py which failed in this environment due to editable dependency metadata for pytorch_connectomics (environment-specific), but the targeted test run PYTHONPATH=. pytest -q tests/test_chat_logging_fields.py executed successfully.
  • Result: tests/test_chat_logging_fields.py passed (2 passed).

Codex Task

@akgohain
Copy link
Copy Markdown
Collaborator Author

Consolidated into draft PR #165 (feat/codex-wave-integration). Closing this source draft to keep review in one place.

@akgohain akgohain closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant