Skip to content

Add structured log for each request that exceeds the configured response time threshold #754

Description

@Chucks1093

Summary

Slow requests are currently invisible until they appear in error logs or user reports. A warn-level log for any request exceeding a configurable threshold (default 2000ms) would give operators a proactive signal of performance degradation without requiring external APM tooling.

Scope

  • Measure total request duration in the response middleware
  • Emit a warn-level log when duration exceeds the threshold with fields: method, path, status_code, duration_ms, wallet (if authenticated), slow_threshold_ms
  • Threshold configurable via environment variable SLOW_REQUEST_THRESHOLD_MS (default 2000)
  • Log emitted after the response is sent, not before
  • Do not log the request body or response body

Acceptance Criteria

  • Warn log emitted for requests exceeding the threshold with all six fields
  • Threshold configurable via environment variable
  • Log emitted after response is sent
  • Request and response bodies absent from log
  • Fast requests produce no slow-request log entry

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions