Improve asyncio instrumentation examples (#3312)
* Improve asyncio instrumentation examples * Port asyncio instrumentation example changes to README.rst --------- Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
This commit is contained in:
parent
ad2fe813ab
commit
d5dce5de99
|
|
@ -55,6 +55,11 @@ Run instrumented application
|
|||
|
||||
# export OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED=true
|
||||
|
||||
import asyncio
|
||||
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor
|
||||
|
||||
AsyncioInstrumentor().instrument()
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
future = asyncio.Future()
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ Run instrumented application
|
|||
|
||||
# export OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED=true
|
||||
|
||||
import asyncio
|
||||
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor
|
||||
|
||||
AsyncioInstrumentor().instrument()
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
future = asyncio.Future()
|
||||
|
|
@ -52,6 +57,8 @@ Run instrumented application
|
|||
-------------
|
||||
.. code:: python
|
||||
|
||||
# export OTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE=func
|
||||
|
||||
import asyncio
|
||||
from opentelemetry.instrumentation.asyncio import AsyncioInstrumentor
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue