OpenTelemetry aiohttp client instrumentation
Project description
This library allows tracing HTTP requests made by the aiohttp client library.
Installation
pip install opentelemetry-instrumentation-aiohttp-client
Example
import asyncio
import aiohttp
from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor
from opentelemetry import trace
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
_JAEGER_EXPORTER = JaegerExporter(
service_name="example-xxx",
agent_host_name="localhost",
agent_port=6831,
)
_TRACE_PROVIDER = TracerProvider()
_TRACE_PROVIDER.add_span_processor(BatchSpanProcessor(_JAEGER_EXPORTER))
trace.set_tracer_provider(_TRACE_PROVIDER)
AioHttpClientInstrumentor().instrument()
async def span_emitter():
async with aiohttp.ClientSession() as session:
async with session.get("https://example.com") as resp:
print(resp.status)
asyncio.run(span_emitter())
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for opentelemetry-instrumentation-aiohttp-client-0.25b2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad7ed85695785eb5934a472fbe0d541485a465104ea4a296a513c6c309f1bf0e |
|
MD5 | 4dc2faf6cc3996dcded1d8012ebf739c |
|
BLAKE2b-256 | 1b6689af05b61939e3f2141c093317ee075f5880c3d7762dc5bcde7650b5cae3 |
Close
Hashes for opentelemetry_instrumentation_aiohttp_client-0.25b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e56504a1c5b86795741a18786d109287687fed60fc357da82e87ce9ee462ab9 |
|
MD5 | 802a7bbeb4f2002bb663bbd655306eb4 |
|
BLAKE2b-256 | cf48d6be1070cb738b28f18352060ee3cbb2b95931353e4bcd816e7555b9b6f6 |