DropEvent does not work in foreign_pre_chain
Nobody has claimed this yet.
- #115 by @gilbsgilbs — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 32/100
Research direction
The report reproduces the issue with the documented standard-library formatter example and a processor that raises DropEvent in pre_chain; start by reading that example and the three issue comments. Check the handling attempted in linked pull request #115 for context. Done means the log is skipped without propagating DropEvent, or the documentation clearly explains the limitation and recommends a stdlib Filter.
Written by the indexing model from the issue text.
Description
Steps to reproduce
- Take this example from the doc.
- Append a processor that raises
DropEventinpre_chain. - Run the example.
Expected behaviour
The log should be skipped.
Actual behaviour
Raises DropEvent; The exception is not caught.
Comments
I don't know if this is really expected or not. There should be at least a disclaimer in the documentation that states clearly that you shouldn't throw DropEvent in pre_chains processors, and you should instead write a stdlib Filter.
However, I reckon there is a way to handle the DropEvent in pre_chain. We could declare a custom Handler that proxies everything to the StreamHandler (or whatever handler is configured), except that we catch/ignore the DropEvent exception in the overidden emit method. This solution implies a tiny overhead on each log, since we have to forward each log entry to the underlying handler.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 302
- Avg merge
- 17m
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hynek/structlog
-
bind_contextvars is not thread-safe?Possibly taken @nosmile99 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Transform examples in docs into included source filesPossibly taken @alexchen-sys claimed this 98 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
waiting for feedback
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Similar issues
-
resource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 88/100
hesreallyhim/awesome-claude-code#3214 · 1 comment ·
Maintainers usually reply within 1 day
-
room-commons replace accepts an empty old string and silently prepends the new text to the pageOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
doobidoo/mcp-memory-service#1650 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ml-explore/mlx-lm#2002 ·
Maintainers usually reply within 2 days