Skip to content

feat: add optional dependencies (extras) for traceloop-sdk integrations, update docs, and require_dependency checks #3241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,20 @@ If you already have OpenTelemetry instrumented, you can just add any of our inst

## 🚀 Getting Started


The easiest way to get started is to use our SDK.
For a complete guide, go to our [docs](https://traceloop.com/docs/openllmetry/getting-started-python).

Install the SDK:
Install the SDK with all instrumentations:

```bash
pip install traceloop-sdk[full]
```

Or, to install only the instrumentations you need (for example, OpenAI and LangChain):

```bash
pip install traceloop-sdk
pip install traceloop-sdk[openai,langchain]
Comment on lines +67 to +76
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Inconsistent extra name (full vs all) creates confusion

README shows pip install traceloop-sdk[full], but the package-level README advertises [all] and the pyproject defines both extras. Consider standardising on a single canonical name (and deprecating the other) to avoid users installing the wrong extra.

🤖 Prompt for AI Agents
In README.md lines 67 to 76, the installation instructions use the extra name
"full" while the package README and pyproject define both "full" and "all"
extras, causing confusion. Standardize on a single extra name by choosing either
"full" or "all" as the canonical name, update the README to use only that name,
and deprecate or remove the other extra from the pyproject and documentation to
prevent user errors.

```

Then, to start instrumenting your code, just add this line to your code:
Expand Down
35 changes: 35 additions & 0 deletions packages/traceloop-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

Traceloop’s Python SDK allows you to easily start monitoring and debugging your LLM execution. Tracing is done in a non-intrusive way, built on top of OpenTelemetry. You can choose to export the traces to Traceloop, or to your existing observability stack.


## Installation


You can now install only the integrations you need, or groups of them:

- All LLM providers:
```bash
pip install traceloop-sdk[llm]
```
- All frameworks:
```bash
pip install traceloop-sdk[frameworks]
```
- All vector stores:
```bash
pip install traceloop-sdk[vectorstores]
```
- All cloud providers:
```bash
pip install traceloop-sdk[cloud]
```
- Everything:
```bash
pip install traceloop-sdk[all]
```
- Or any combination, e.g.:
```bash
pip install traceloop-sdk[openai,chromadb]
```

This keeps your install minimal and fast!

---

```python
Traceloop.init(app_name="joke_generation_service")

Expand Down
176 changes: 141 additions & 35 deletions packages/traceloop-sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,6 @@ opentelemetry-api = "^1.28.0"
opentelemetry-sdk = "^1.28.0"
opentelemetry-exporter-otlp-proto-http = "^1.28.0"
opentelemetry-exporter-otlp-proto-grpc = "^1.28.0"
opentelemetry-instrumentation-logging = ">=0.50b0"
opentelemetry-instrumentation-requests = ">=0.50b0"
opentelemetry-instrumentation-sqlalchemy = ">=0.50b0"
opentelemetry-instrumentation-urllib3 = ">=0.50b0"
opentelemetry-instrumentation-threading = ">=0.50b0"
opentelemetry-instrumentation-redis = ">=0.50b0"
opentelemetry-semantic-conventions-ai = "0.4.11"
opentelemetry-instrumentation-mistralai = { path = "../opentelemetry-instrumentation-mistralai", develop = true }
opentelemetry-instrumentation-openai = { path = "../opentelemetry-instrumentation-openai", develop = true }
opentelemetry-instrumentation-openai-agents = { path = "../opentelemetry-instrumentation-openai-agents", develop = true }
opentelemetry-instrumentation-ollama = { path = "../opentelemetry-instrumentation-ollama", develop = true }
opentelemetry-instrumentation-anthropic = { path = "../opentelemetry-instrumentation-anthropic", develop = true }
opentelemetry-instrumentation-cohere = { path = "../opentelemetry-instrumentation-cohere", develop = true }
opentelemetry-instrumentation-crewai = { path = "../opentelemetry-instrumentation-crewai", develop = true }
opentelemetry-instrumentation-google-generativeai = { path = "../opentelemetry-instrumentation-google-generativeai", develop = true }
opentelemetry-instrumentation-pinecone = { path = "../opentelemetry-instrumentation-pinecone", develop = true }
opentelemetry-instrumentation-qdrant = { path = "../opentelemetry-instrumentation-qdrant", develop = true }
opentelemetry-instrumentation-langchain = { path = "../opentelemetry-instrumentation-langchain", develop = true }
opentelemetry-instrumentation-lancedb = { path = "../opentelemetry-instrumentation-lancedb", develop = true }
opentelemetry-instrumentation-chromadb = { path = "../opentelemetry-instrumentation-chromadb", develop = true }
opentelemetry-instrumentation-transformers = { path = "../opentelemetry-instrumentation-transformers", develop = true }
opentelemetry-instrumentation-together = { path = "../opentelemetry-instrumentation-together", develop = true }
opentelemetry-instrumentation-llamaindex = { path = "../opentelemetry-instrumentation-llamaindex", develop = true }
opentelemetry-instrumentation-milvus = { path = "../opentelemetry-instrumentation-milvus", develop = true }
opentelemetry-instrumentation-haystack = { path = "../opentelemetry-instrumentation-haystack", develop = true }
opentelemetry-instrumentation-bedrock = { path = "../opentelemetry-instrumentation-bedrock", develop = true }
opentelemetry-instrumentation-sagemaker = { path = "../opentelemetry-instrumentation-sagemaker", develop = true }
opentelemetry-instrumentation-replicate = { path = "../opentelemetry-instrumentation-replicate", develop = true }
opentelemetry-instrumentation-vertexai = { path = "../opentelemetry-instrumentation-vertexai", develop = true }
opentelemetry-instrumentation-watsonx = { path = "../opentelemetry-instrumentation-watsonx", develop = true }
opentelemetry-instrumentation-weaviate = { path = "../opentelemetry-instrumentation-weaviate", develop = true }
opentelemetry-instrumentation-alephalpha = { path = "../opentelemetry-instrumentation-alephalpha", develop = true }
opentelemetry-instrumentation-marqo = { path = "../opentelemetry-instrumentation-marqo", develop = true }
opentelemetry-instrumentation-groq = { path = "../opentelemetry-instrumentation-groq", develop = true }
opentelemetry-instrumentation-mcp = { path = "../opentelemetry-instrumentation-mcp", develop = true }
colorama = "^0.4.6"
tenacity = ">=8.2.3, <10.0"
pydantic = ">=1"
Expand All @@ -89,5 +54,146 @@ langchain = "^0.2.5"
langchain-openai = "^0.1.15"

[build-system]
[tool.poetry.extras]
llm = [
"../opentelemetry-instrumentation-openai",
"../opentelemetry-instrumentation-anthropic",
"../opentelemetry-instrumentation-cohere",
"../opentelemetry-instrumentation-groq",
"../opentelemetry-instrumentation-ollama",
"../opentelemetry-instrumentation-mistralai",
"../opentelemetry-instrumentation-bedrock",
"../opentelemetry-instrumentation-sagemaker",
"../opentelemetry-instrumentation-replicate",
"../opentelemetry-instrumentation-vertexai",
"../opentelemetry-instrumentation-watsonx",
"../opentelemetry-instrumentation-google-generativeai",
"../opentelemetry-instrumentation-alephalpha"
]
frameworks = [
"../opentelemetry-instrumentation-langchain",
"../opentelemetry-instrumentation-llamaindex",
"../opentelemetry-instrumentation-crewai",
"../opentelemetry-instrumentation-haystack",
"../opentelemetry-instrumentation-transformers",
"../opentelemetry-instrumentation-together"
]
vectorstores = [
"../opentelemetry-instrumentation-pinecone",
"../opentelemetry-instrumentation-qdrant",
"../opentelemetry-instrumentation-weaviate",
"../opentelemetry-instrumentation-chromadb",
"../opentelemetry-instrumentation-lancedb",
"../opentelemetry-instrumentation-milvus",
"../opentelemetry-instrumentation-marqo"
]
cloud = [
"../opentelemetry-instrumentation-bedrock",
"../opentelemetry-instrumentation-vertexai",
"../opentelemetry-instrumentation-sagemaker",
"../opentelemetry-instrumentation-watsonx",
"../opentelemetry-instrumentation-google-generativeai"
]
minimal = [
"opentelemetry-api",
"opentelemetry-sdk",
"opentelemetry-exporter-otlp-proto-http",
"opentelemetry-exporter-otlp-proto-grpc",
"colorama",
"tenacity",
"pydantic",
"jinja2",
"deprecated",
"posthog",
"aiohttp"
]
all = [
"llm",
"frameworks",
"vectorstores",
"cloud",
"logging",
"requests",
"sqlalchemy",
"urllib3",
"threading",
"redis",
Comment on lines +110 to +120
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Duplicate catch-all extras (all vs full)

Maintaining two overlapping aggregates increases maintenance cost and opens the door for drift. Pick one (preferably the one promoted in docs) and drop the other.

🤖 Prompt for AI Agents
In packages/traceloop-sdk/pyproject.toml around lines 110 to 120, there are two
overlapping catch-all extras named 'all' and 'full'. To reduce maintenance
overhead and avoid inconsistencies, choose one of these extras—preferably the
one recommended in the documentation—and remove the other from the file.

"semantic-conventions-ai",
"../opentelemetry-instrumentation-openai-agents",
"../opentelemetry-instrumentation-mcp",
"../opentelemetry-instrumentation-groq"
]
logging = ["opentelemetry-instrumentation-logging"]
requests = ["opentelemetry-instrumentation-requests"]
sqlalchemy = ["opentelemetry-instrumentation-sqlalchemy"]
urllib3 = ["opentelemetry-instrumentation-urllib3"]
threading = ["opentelemetry-instrumentation-threading"]
redis = ["opentelemetry-instrumentation-redis"]
semantic-conventions-ai = ["opentelemetry-semantic-conventions-ai"]
mistralai = ["../opentelemetry-instrumentation-mistralai"]
openai = ["../opentelemetry-instrumentation-openai"]
openai-agents = ["../opentelemetry-instrumentation-openai-agents"]
ollama = ["../opentelemetry-instrumentation-ollama"]
anthropic = ["../opentelemetry-instrumentation-anthropic"]
cohere = ["../opentelemetry-instrumentation-cohere"]
crewai = ["../opentelemetry-instrumentation-crewai"]
google-generativeai = ["../opentelemetry-instrumentation-google-generativeai"]
pinecone = ["../opentelemetry-instrumentation-pinecone"]
qdrant = ["../opentelemetry-instrumentation-qdrant"]
langchain = ["../opentelemetry-instrumentation-langchain"]
lancedb = ["../opentelemetry-instrumentation-lancedb"]
chromadb = ["../opentelemetry-instrumentation-chromadb"]
transformers = ["../opentelemetry-instrumentation-transformers"]
together = ["../opentelemetry-instrumentation-together"]
llamaindex = ["../opentelemetry-instrumentation-llamaindex"]
milvus = ["../opentelemetry-instrumentation-milvus"]
haystack = ["../opentelemetry-instrumentation-haystack"]
bedrock = ["../opentelemetry-instrumentation-bedrock"]
sagemaker = ["../opentelemetry-instrumentation-sagemaker"]
replicate = ["../opentelemetry-instrumentation-replicate"]
vertexai = ["../opentelemetry-instrumentation-vertexai"]
watsonx = ["../opentelemetry-instrumentation-watsonx"]
weaviate = ["../opentelemetry-instrumentation-weaviate"]
alephalpha = ["../opentelemetry-instrumentation-alephalpha"]
marqo = ["../opentelemetry-instrumentation-marqo"]
groq = ["../opentelemetry-instrumentation-groq"]
mcp = ["../opentelemetry-instrumentation-mcp"]
Comment on lines 56 to +160
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Extras reference local paths – will break for users installing from PyPI

[tool.poetry.extras] entries like "../opentelemetry-instrumentation-openai" point to a relative path that will not exist in a regular pip install scenario. Extras must reference publishable package names (e.g. opentelemetry-instrumentation-openai) rather than local paths.
This will block installation outside the monorepo.

🤖 Prompt for AI Agents
In packages/traceloop-sdk/pyproject.toml between lines 56 and 160, the
[tool.poetry.extras] section uses local relative paths like
"../opentelemetry-instrumentation-openai" which will break installations from
PyPI. Replace all these local path references with the corresponding publishable
package names such as "opentelemetry-instrumentation-openai" to ensure the
extras work correctly when installed via pip outside the monorepo.

full = [
"opentelemetry-instrumentation-logging",
"opentelemetry-instrumentation-requests",
"opentelemetry-instrumentation-sqlalchemy",
"opentelemetry-instrumentation-urllib3",
"opentelemetry-instrumentation-threading",
"opentelemetry-instrumentation-redis",
"opentelemetry-semantic-conventions-ai",
"../opentelemetry-instrumentation-mistralai",
"../opentelemetry-instrumentation-openai",
"../opentelemetry-instrumentation-openai-agents",
"../opentelemetry-instrumentation-ollama",
"../opentelemetry-instrumentation-anthropic",
"../opentelemetry-instrumentation-cohere",
"../opentelemetry-instrumentation-crewai",
"../opentelemetry-instrumentation-google-generativeai",
"../opentelemetry-instrumentation-pinecone",
"../opentelemetry-instrumentation-qdrant",
"../opentelemetry-instrumentation-langchain",
"../opentelemetry-instrumentation-lancedb",
"../opentelemetry-instrumentation-chromadb",
"../opentelemetry-instrumentation-transformers",
"../opentelemetry-instrumentation-together",
"../opentelemetry-instrumentation-llamaindex",
"../opentelemetry-instrumentation-milvus",
"../opentelemetry-instrumentation-haystack",
"../opentelemetry-instrumentation-bedrock",
"../opentelemetry-instrumentation-sagemaker",
"../opentelemetry-instrumentation-replicate",
"../opentelemetry-instrumentation-vertexai",
"../opentelemetry-instrumentation-watsonx",
"../opentelemetry-instrumentation-weaviate",
"../opentelemetry-instrumentation-alephalpha",
"../opentelemetry-instrumentation-marqo",
"../opentelemetry-instrumentation-groq",
"../opentelemetry-instrumentation-mcp"
]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading