2025-12-02 18:54:14 +08:00

2.2 KiB

ADDED Requirements

Requirement: Third-Party API Request/Response Logging

The system SHALL log complete request and response content for all third-party API calls (such as DashScope API). The system SHALL record request parameters, response data, and status information. The system SHALL mask sensitive information (such as API keys) in logs. The system SHALL use appropriate log levels (DEBUG for detailed content, INFO for summaries).

Scenario: Successful API Call Logging

  • WHEN the system makes a third-party API call (e.g., DashScope API for video analysis)
  • THEN the system SHALL log the complete request content including:
    • AND request parameters (model, messages, fps, etc.)
    • AND request headers (with API key masked)
    • AND request timestamp
  • AND the system SHALL log the complete response content including:
    • AND response status code
    • AND response body/content
    • AND response headers (if available)
    • AND response timestamp
  • AND the system SHALL use DEBUG log level for detailed content
  • AND the system SHALL use INFO log level for summary information

Scenario: API Key Masking in Logs

  • WHEN the system logs API request information containing sensitive data (API keys)
  • THEN the system SHALL mask the API key showing only the first few and last few characters
  • AND the system SHALL replace the middle portion with asterisks or similar masking characters
  • AND the system SHALL ensure no sensitive information is exposed in logs

Scenario: Failed API Call Logging

  • WHEN a third-party API call fails
  • THEN the system SHALL log the complete error response including:
    • AND error status code
    • AND error message
    • AND error details (if available)
    • AND request that caused the error
  • AND the system SHALL use ERROR or WARNING log level for failed calls

Scenario: Large Response Logging

  • WHEN the system receives a large response from a third-party API
  • THEN the system SHALL log the response content
  • AND the system SHALL handle large responses appropriately (e.g., truncate very large content or log summary)
  • AND the system SHALL ensure logs remain readable and manageable