You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(asgi,fastapi,starlette)!: provide both send and receive hooks with scope and message
Currently, a «receive» hook is only provided with `scope`, but not `message`. On contrary, a «send» hook is only provided with `message`, but not `scope`.
This change unifies the both hooks and provides them with additional request info.
This is a breaking change:
- The hooks will now be provided with one more positional argument
- `client_request_hook` will be called _after_ `receive()` instead of _before_ `receive()`
- ASGI, FastAPI, Starlette: provide both send and receive hooks with `scope` and `message` ([#2546](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2546))
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py
+16-15
Original file line number
Diff line number
Diff line change
@@ -59,20 +59,20 @@ async def foobar():
59
59
right after a span is created for a request and right before the span is finished for the response.
60
60
61
61
- The server request hook is passed a server span and ASGI scope object for every incoming request.
62
-
- The client request hook is called with the internal span and an ASGI scope when the method ``receive`` is called.
63
-
- The client response hook is called with the internal span and an ASGI event when the method ``send`` is called.
62
+
- The client request hook is called with the internal span, and ASGI scope and event when the method ``receive`` is called.
63
+
- The client response hook is called with the internal span, and ASGI scope and event when the method ``send`` is called.
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py
+18-16
Original file line number
Diff line number
Diff line change
@@ -55,20 +55,22 @@ def home(request):
55
55
right after a span is created for a request and right before the span is finished for the response.
56
56
57
57
- The server request hook is passed a server span and ASGI scope object for every incoming request.
58
-
- The client request hook is called with the internal span and an ASGI scope when the method ``receive`` is called.
59
-
- The client response hook is called with the internal span and an ASGI event when the method ``send`` is called.
58
+
- The client request hook is called with the internal span, and ASGI scope and event when the method ``receive`` is called.
59
+
- The client response hook is called with the internal span, and ASGI scope and event when the method ``send`` is called.
0 commit comments