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.23b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cbe812878642c2a091cfd7b1384503e0236db86e6f3c92e3bf9e4b5d5456536 |
|
MD5 | 0b8c71f9cb7f9c7613848cc28a5b4989 |
|
BLAKE2b-256 | 9733b3cc26621ff688d868b0f2b18a762b47781a63595c09a0b3542b8b7badc6 |
Close
Hashes for opentelemetry_instrumentation_aiohttp_client-0.23b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62cb804b3ad00df33a5826b376129850f6713abfd895c8a3347c49018f5509ad |
|
MD5 | ad027d4e113716bd6cc5f05c564714b1 |
|
BLAKE2b-256 | 1042a8bf370222b1e4e3fa6a5f129b054fc15b5a6c8f8058c800fa1602c96551 |