Remove request object from logging extra fields#72
Merged
Conversation
The exception/405/host-validation log calls put the raw `Request` object into `extra`. plain.connect's OTel `LoggingHandler` copies every non-standard LogRecord attribute into OTel log attributes, and a `Request` is not a valid attribute type — so `opentelemetry.attributes` emits an "Invalid type Request for attribute value" warning on every such record. Nothing reads `record.request`; the adjacent `path` key already carries the useful context. https://claude.ai/code/session_014onNMrdDjC8tete8jMbCDA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove the
requestobject from loggingextradictionaries across the codebase. Request objects are not JSON-serializable and can cause issues with structured logging systems.Changes
"request": requestfrom the extra dict in the 400 warning log"request": requestfrom the base extra dict used in exception logging"request": self.requestfrom the extra dict in the 405 method not allowed logDetails
The request object was being passed in logging extra fields, but this causes problems with JSON serialization in structured logging. The relevant request information (path, method, status_code) is already being logged separately, so removing the request object itself doesn't lose important context while improving compatibility with logging backends.
https://claude.ai/code/session_014onNMrdDjC8tete8jMbCDA