Skip to content

Commit f697c7a

Browse files
authored
Merge branch 'main' into fix-aiokafka
2 parents 5795d44 + 04f9e8d commit f697c7a

File tree

1 file changed

+5
-1
lines changed
  • instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette

1 file changed

+5
-1
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def home(request):
6262
6363
.. code-block:: python
6464
65+
from opentelemetry.instrumentation.starlette import StarletteInstrumentor
66+
from opentelemetry.trace import Span
67+
from typing import Any
68+
6569
def server_request_hook(span: Span, scope: dict[str, Any]):
6670
if span and span.is_recording():
6771
span.set_attribute("custom_user_attribute_from_request_hook", "some-value")
@@ -74,7 +78,7 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
7478
if span and span.is_recording():
7579
span.set_attribute("custom_user_attribute_from_response_hook", "some-value")
7680
77-
StarletteInstrumentor().instrument(server_request_hook=server_request_hook, client_request_hook=client_request_hook, client_response_hook=client_response_hook)
81+
StarletteInstrumentor().instrument(server_request_hook=server_request_hook, client_request_hook=client_request_hook, client_response_hook=client_response_hook)
7882
7983
Capture HTTP request and response headers
8084
*****************************************

0 commit comments

Comments
 (0)