Repository navigation
fix: preserve request attributes on shared log records - #58
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Problem
When a Django-style request object (or
None) is attached to aLogRecord,create_framedeletes the request attribute from the record itself. The same record is passed to other Python logging handlers, so Better Stack's formatter or handler can prevent subsequent handlers from accessing their request context.Change
Move the existing request-type filter into
_parse_custom_events. Unsupported request values are still omitted from Better Stack output, while the original record remains intact. The existing allowlist andinclude_extra_attributesbehavior are preserved.Fixes #57.
Validation
nosetests --with-coverage --cover-branches --cover-package=logtail— 65 tests passed, 96% total branch-aware coverage.git diff --checkpass.reset; reproduced on unchanged upstream without the new tests (59 tests pass). No change to fork/upload handling here.AI assistance: OpenAI Codex investigated, implemented, tested, and prepared this draft. Human verification is not claimed.