Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/traceloop-sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies = [
"opentelemetry-instrumentation-llamaindex",
"opentelemetry-instrumentation-milvus",
"opentelemetry-instrumentation-haystack",
"opentelemetry-instrumentation-httpx>=0.59b0",
"opentelemetry-instrumentation-bedrock",
"opentelemetry-instrumentation-sagemaker",
"opentelemetry-instrumentation-replicate",
Expand Down
1 change: 1 addition & 0 deletions packages/traceloop-sdk/traceloop/sdk/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Instruments(Enum):
GOOGLE_GENERATIVEAI = "google_generativeai"
GROQ = "groq"
HAYSTACK = "haystack"
HTTPCLIENT = "httpclient"
LANCEDB = "lancedb"
LANGCHAIN = "langchain"
LITELLM = "litellm"
Expand Down
17 changes: 17 additions & 0 deletions packages/traceloop-sdk/traceloop/sdk/tracing/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ def init_instrumentations(
elif instrument == Instruments.HAYSTACK:
if init_haystack_instrumentor():
instrument_set = True
elif instrument == Instruments.HTTPCLIENT:
if init_httpclient_instrumentor():
instrument_set = True
elif instrument == Instruments.LANCEDB:
if init_lancedb_instrumentor():
instrument_set = True
Expand Down Expand Up @@ -783,6 +786,20 @@ def init_haystack_instrumentor():
return False


def init_httpclient_instrumentor():
try:
if is_package_installed("httpx"):
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor

instrumentor = HTTPXClientInstrumentor()
if not instrumentor.is_instrumented_by_opentelemetry:
instrumentor.instrument()
return True
except Exception as e:
logging.error(f"Error initializing HTTPX instrumentor: {e}")
return False


def init_langchain_instrumentor(use_attributes: bool = True):
try:
if is_package_installed("langchain") or is_package_installed("langgraph"):
Expand Down