Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

Fix: HTTPX instrumentation

Clémence Lesnéaf32ec9e0c4c
diff --git a/helpers/logging.py b/helpers/logging.py
index d781159..497f249 100644
--- a/helpers/logging.py
+++ b/helpers/logging.py
@@ -3,6 +3,7 @@ from helpers.config import CONFIG
from logging import getLogger, basicConfig
from opentelemetry import trace
from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor
+from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
from os import getenv
@@ -18,6 +19,7 @@ configure_azure_monitor(
connection_string=getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"),
) # Configure Azure Application Insights exporter
AioHttpClientInstrumentor().instrument() # Instrument aiohttp
+HTTPXClientInstrumentor().instrument() # Instrument httpx
tracer = trace.get_tracer(
instrumenting_library_version=CONFIG.version,
instrumenting_module_name=f"com.github.clemlesne.{APP_NAME}",
diff --git a/requirements.txt b/requirements.txt
index a1a9086..7d9a1a4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -17,6 +17,7 @@ json-repair==0.20.1
mistune==3.0.2
openai==1.30.3
opentelemetry-instrumentation-aiohttp-client==0.46b0
+opentelemetry-instrumentation-httpx==0.46b0
opentelemetry-instrumentation-openai==0.21.4
opentelemetry-instrumentation-redis==0.46b0
opentelemetry-instrumentation-sqlite3==0.46b0