feat: Add Status Code and Request and Response Bodies to Logs#1358
feat: Add Status Code and Request and Response Bodies to Logs#1358dan-fernandes wants to merge 7 commits intomainfrom
Conversation
| ) | ||
|
|
||
| extra = { | ||
| "request_body": request_body, |
There was a problem hiding this comment.
The response body could be massive (in theory), this is why the FastAPI tracing does not set it as an attribute by default, rather they recommend truncating it when manually adding it to the trace, if it is over a certain length. So it could be useful to add this modality, possibly as a selectable option that defaults to truncate=true as there may legitimately be times when you want to see the whole response to a particular request in the log.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1358 +/- ##
=======================================
Coverage 95.01% 95.02%
=======================================
Files 43 43
Lines 2768 2773 +5
=======================================
+ Hits 2630 2635 +5
Misses 138 138 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Could we add some logging (possibly at debug?) when the request is received as well? Running a plan with this logging now gives something like where the plan appears to start before the request that started it. Making the |
Logs now have status code. Logs now have request and response bodies as attributes to log record (accessible via Graylog). Logs now look prettier.
Example: