Skip to content

Add structured log for each API request with method, route, status code, and response time #668

Description

@Chucks1093

Summary

The server has no request-level access log, making it impossible to compute request rates or p95 latencies from logs alone. An info-level log should be emitted for every API request after the response is sent.

Scope

  • Add middleware that emits an info-level log after each response with fields: method, route (parametrised path, not the raw URL), status_code, duration_ms
  • Route should be the matched route pattern (e.g. /creators/:id) not the raw request URL (e.g. /creators/GABC...) to avoid high-cardinality log keys
  • Middleware should run after the response is sent so duration_ms includes response serialisation

Acceptance Criteria

  • Log emitted for every API request after response is sent
  • All four fields present with correct values
  • Route is the parametrised pattern, not the raw URL
  • duration_ms reflects full request-to-response time

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions