Skip to content

Backend chat observability: standardized request summary logging#148

Closed
akgohain wants to merge 1 commit into
mainfrom
codex/standardize-logging-for-chat-endpoints-ke3bbf
Closed

Backend chat observability: standardized request summary logging#148
akgohain wants to merge 1 commit into
mainfrom
codex/standardize-logging-for-chat-endpoints-ke3bbf

Conversation

@akgohain
Copy link
Copy Markdown
Collaborator

Motivation

  • Standardize a compact, machine-parseable summary log for chat/workflow-agent endpoints to surface request_id, endpoint, latency_ms, status, and error_type for quick diagnosis of stalls and failures.
  • Preserve existing verbose/debug logging while preventing sensitive request payloads from appearing in the single-line summaries.

Description

  • Added a dedicated logger and helper function _log_chat_request_summary in server_api/main.py that emits single-line structured summary logs with request_id, endpoint, latency_ms, status, and error_type.
  • Instrumented chat endpoints (/chat/query, /chat/clear, /chat/status, /chat/helper/query, /chat/helper/clear) to generate a request_id, compute latency using time.perf_counter(), and call the summary helper on both success and error paths without including request payloads.
  • Kept existing endpoint logic and verbose prints/behavior intact so there is no breaking API change.
  • Added tests/test_chat_logging_fields.py to assert presence of the standardized fields in the summary log lines and to ensure sensitive text (e.g., the query payload) is not leaked.

Testing

  • Attempted uv run pytest -q tests/test_chat_logging_fields.py which failed in this environment due to editable package metadata resolution for pytorch_connectomics (environment-specific issue).
  • Ran PYTHONPATH=. pytest -q tests/test_chat_logging_fields.py which passed (3 passed).
  • The tests exercise success and failure paths and validate the summary fields and absence of sensitive payload content in the summary logs.

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