| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
I didn't realize I created those tests. I don't think they are necessary. We already have tests for otel.
Sorry, something went wrong.
…dleware` Move `method` and `params` onto `ServerRequestContext` so context-tier middleware reads `ctx.method`/`ctx.params` instead of separate positional args. `CallNext` now takes the context, so middleware can rewrite the inbound message with `call_next(replace(ctx, params=...))`. Add a context-tier `OpenTelemetryMiddleware` alongside the existing dispatch-tier `otel_middleware`, which is left intact.
- OpenTelemetryMiddleware: nest under the ambient span when no traceparent is present. Passing an explicit empty Context to start_as_current_span orphans the span; extract_trace_context now returns None for an absent or malformed carrier so callers fall through to ambient parenting. Adds a regression test with both span tiers installed. - Rename 'mw' -> 'middleware' across runner.py; drop redundant CallNext annotation on the compose-loop accumulator. - Document that 'initialize' is observed by ServerMiddleware but not rewritable: the post-chain handshake commit reads the wire params, so a rewritten ctx.params on initialize does not reach connection state. TODO at the commit site names the desync triggers; resolves when initialize becomes a built-in handler.
A non-empty _meta without a traceparent key (e.g. only a progressToken) made extract() return an empty Context, which orphans the span when passed explicitly to start_as_current_span. Check the extracted context carries a valid span and return None otherwise so callers fall through to ambient parenting.
|
This pull request is included in pre-release v2.0.0a3 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What
Reshapes the context-tier ServerMiddleware interface and adds a context-tier OpenTelemetryMiddleware.
Why
The 4-arg signature duplicated method/params that already belong on the context, and call_next() could only observe, not rewrite. The new shape matches the pure-ASGI middleware model (single context in, pass it through, mutate before next) and lets middleware redirect params before the handler runs.
Notes
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.