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 import jaeger
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor
_JAEGER_EXPORTER = jaeger.JaegerSpanExporter(
service_name="example-xxx",
agent_host_name="localhost",
agent_port=6831,
)
_TRACE_PROVIDER = TracerProvider()
_TRACE_PROVIDER.add_span_processor(BatchExportSpanProcessor(_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.18b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d872502857a8b14f7a010710485bbf4ad9e890175eba3585ee4699dedac18d61 |
|
MD5 | 28852ee1ab3928e11d71804a31a801db |
|
BLAKE2b-256 | 076e8017ad5adb20dd9f0c2cac4c87a1ddeccde9f97291aa05bf4de98c548a11 |
Close
Hashes for opentelemetry_instrumentation_aiohttp_client-0.18b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1913e7499e71de6a463fb204222532a553bde6023bc268b35ea4d1112f5ae9d |
|
MD5 | 8b769cb38c653cc3d27aa8c313818ffc |
|
BLAKE2b-256 | 2486e32e6f674cf45e991322e06ddf1650ee4183a53356124ea23ead5cdc831b |