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.25b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3090b3c343ac1555780ccff7ffb6fb319d7df6b4eee1d198d655029af82b28b0 |
|
MD5 | 41c4f7ae0d3f226a9f058961a5d7f840 |
|
BLAKE2b-256 | f77851fccccbd579cfc35769dbc624ee853dff1f022f983b210fca53228e942b |
Close
Hashes for opentelemetry_instrumentation_aiohttp_client-0.25b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47d64736fcea19cb533dd957c15f2997e29c58b11f6037354375196d19711b07 |
|
MD5 | 1e197761ea0ee4c0c9c6c2441d698d72 |
|
BLAKE2b-256 | 3854ff01afb177365a7867706f78aa91f2633efdb85bfc17f19cf783d7043fef |