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.21b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d84dab430c0f3f3055d52fbe6e9d30d1433d3733e90a62fef2b15961283c5d49 |
|
MD5 | f215a7c2652d6d6b96286e2ca161fdee |
|
BLAKE2b-256 | 7fd2988a54e7a5041ec87f56771d0197411708d62f50d679b186884798403c72 |
Close
Hashes for opentelemetry_instrumentation_aiohttp_client-0.21b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f793180bbf333da0d871c0d9c721371d9f536f899448da4097b186a27d309e |
|
MD5 | eed8c6a6256b0bcda6c9460c306888cd |
|
BLAKE2b-256 | b5122540046688a1e3e6aad003076fe1321e015309601a93595735df126bf90a |