Skip to content

logging: silence tungstenite/tokio_tungstenite DEBUG noise too - #710

Merged
ajslater merged 1 commit into
v1.11-performancefrom
claude/silence-tungstenite-debug
May 4, 2026
Merged

ajslater merged 1 commit into
v1.11-performancefrom
claude/silence-tungstenite-debug

Conversation

@ajslater

@ajslater ajslater commented May 4, 2026

Copy link
Copy Markdown
Owner

Summary

The earlier _granian filter (#704) didn't actually silence the WebSocket close-frame DEBUG noise users were still seeing. Those messages originate from the tungstenite / tokio_tungstenite crates that Granian uses for its WS layer, not from _granian itself.

DEBUG | Received close frame: Some(CloseFrame { code: Normal, … })
DEBUG | Replying to close with Frame { … Control(Close) … }
DEBUG | websocket start_send error: WebSocket protocol error: Sending after closing is not allowed

pyo3-log routes Rust tracing targets to Python loggers, mapping ::., so e.g. tungstenite::protocol arrives as the Python logger tungstenite.protocol. Filtering the bare crate name applies hierarchically to all submodules.

Test plan

  • make lint-python clean
  • make ty clean
  • pytest tests/ clean (26 passed)
  • Apply the dictConfig in a Python REPL and confirm:
    • tungstenite.protocol effective level → INFO, isEnabledFor(DEBUG) → False
    • tokio_tungstenite.compat effective level → INFO, isEnabledFor(DEBUG) → False
    • _granian.asgi.io effective level → INFO (existing filter still works)
    • root effective level → DEBUG (codex code unaffected)
  • Verify in production Docker that the close-frame DEBUG lines no longer appear

Note

make lint (the wrapping script, not the underlying tools) errors on nginx/http.d with "Cannot process specified file: it's ignored" — reproducible without my changes, so unrelated. Worth fixing separately.

🤖 Generated with Claude Code

The earlier ``_granian`` filter (#704) didn't catch the close-frame
DEBUG messages users were still seeing — those originate from the
``tungstenite`` and ``tokio_tungstenite`` crates that Granian uses
for the WebSocket layer, not from ``_granian`` itself.

pyo3-log routes Rust tracing targets to Python loggers, mapping
``::`` → ``.`` so e.g. ``tungstenite::protocol`` arrives as the
Python logger ``tungstenite.protocol``. Filtering the bare crate
name applies hierarchically to all submodules.

Verified by applying the dictConfig and reading effective levels:
``tungstenite.protocol`` and ``tokio_tungstenite.compat`` now resolve
to INFO with ``isEnabledFor(DEBUG) == False``; root stays at DEBUG
so codex code is unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ajslater
ajslater merged commit 0dd803e into v1.11-performance May 4, 2026
1 check failed
@ajslater
ajslater deleted the claude/silence-tungstenite-debug branch May 4, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant