Skip to content

Commit d5dce5d

Browse files
andremmxrmx
andauthored
Improve asyncio instrumentation examples (#3312)
* Improve asyncio instrumentation examples * Port asyncio instrumentation example changes to README.rst --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
1 parent ad2fe81 commit d5dce5d

File tree

2 files changed

+12
-0
lines changed
  • instrumentation/opentelemetry-instrumentation-asyncio

2 files changed

+12
-0
lines changed

instrumentation/opentelemetry-instrumentation-asyncio/README.rst

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ Run instrumented application
5555
5656
# export OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED=true
5757
58+
import asyncio
59+
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor
60+
61+
AsyncioInstrumentor().instrument()
62+
5863
loop = asyncio.get_event_loop()
5964
6065
future = asyncio.Future()

instrumentation/opentelemetry-instrumentation-asyncio/src/opentelemetry/instrumentation/asyncio/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ async def main():
4141
4242
# export OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED=true
4343
44+
import asyncio
45+
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor
46+
47+
AsyncioInstrumentor().instrument()
48+
4449
loop = asyncio.get_event_loop()
4550
4651
future = asyncio.Future()
@@ -52,6 +57,8 @@ async def main():
5257
-------------
5358
.. code:: python
5459
60+
# export OTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE=func
61+
5562
import asyncio
5663
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor
5764

0 commit comments

Comments
 (0)