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.24b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bab057cc62a3f1fed5bea9b4899485585df48cc76c74ae4e63495827560a6320 |
|
MD5 | a1d95634f0f98a1d75b94665040a1640 |
|
BLAKE2b-256 | 260296f7aa3f6533db4597a2806554107f41c095de81a503fd6b506ff787049d |
Close
Hashes for opentelemetry_instrumentation_aiohttp_client-0.24b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c0ea4086729ef390f13663efc82fddf3dcf7506d74de07e0c803c1fe3a326e |
|
MD5 | dd19eec35e40edda65edcc9ae811226c |
|
BLAKE2b-256 | f237da8628be4c3218e181b137a6cce917268b96fc94906721c65a64bb624231 |