Is your feature request related to a problem?
In Sentry, we observed slow transactions running for up to ~1 minute that then failed with 400 Bad Request. We suspect these are caused by unusually large request payloads, but the HTTP request logger middleware currently does not log request payload size — so there is no way to confirm this by correlating payload size with a specific request (via its correlation ID) in Sentry or AWS CloudWatch.
Describe the solution you'd like
Modify app/core/middleware.py (_log_http_request) to:
- Capture the request body size from the
Content-Length header (0 when absent/malformed).
- Add it as the
http.request.body.size span attribute (OTel semantic convention) so it reaches Sentry via the OTel instrumenter.
- Include
request_body_size and correlation_id in the access log line, which flows to both Sentry (LoggingIntegration) and AWS CloudWatch (stdout log shipping).
- Emit a
http.server.request.body.size distribution metric to Sentry alongside the existing request count/duration metrics.
This will let us confirm (or rule out) the large-payload hypothesis for the slow 400 transactions.
Is your feature request related to a problem?
In Sentry, we observed slow transactions running for up to ~1 minute that then failed with
400 Bad Request. We suspect these are caused by unusually large request payloads, but the HTTP request logger middleware currently does not log request payload size — so there is no way to confirm this by correlating payload size with a specific request (via its correlation ID) in Sentry or AWS CloudWatch.Describe the solution you'd like
Modify
app/core/middleware.py(_log_http_request) to:Content-Lengthheader (0 when absent/malformed).http.request.body.sizespan attribute (OTel semantic convention) so it reaches Sentry via the OTel instrumenter.request_body_sizeandcorrelation_idin the access log line, which flows to both Sentry (LoggingIntegration) and AWS CloudWatch (stdout log shipping).http.server.request.body.sizedistribution metric to Sentry alongside the existing request count/duration metrics.This will let us confirm (or rule out) the large-payload hypothesis for the slow 400 transactions.