opentelemetry-instrumentation-ollama
OpenTelemetry Ollama instrumentation
What it is and what it does
This package wraps the Ollama Python client to emit OpenTelemetry spans for every call to Ollama's endpoints. It integrates with your existing OpenTelemetry setup (API, instrumentation base, and semantic conventions) to capture request and response details as structured trace data. By default, it logs prompts, completions, and embeddings to span attributes for full visibility into LLM behavior; you can disable this via the TRACELOOP_TRACE_CONTENT environment variable if the data contains sensitive information or you want smaller traces.
The instrumentation is designed for developers building LLM applications who need observability into Ollama calls without modifying their application code. It follows the OpenTelemetry semantic conventions for AI systems, making traces compatible with standard observability platforms and tools.
Use it for:
- Debug LLM application behavior by inspecting prompts, completions, and response latencies in distributed traces.
- Monitor Ollama endpoint performance and error rates across your infrastructure using OpenTelemetry exporters.
- Audit LLM interactions for compliance or quality assurance by capturing full request/response data in traces.
- Correlate Ollama calls with upstream application logic using trace context propagation.
- Reduce trace size and remove sensitive data by disabling content logging in production deployments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds distributed tracing to Ollama Python client calls, capturing request and response data as OpenTelemetry spans for observability and debugging.
Yes, if you are already using OpenTelemetry in your application and need visibility into Ollama calls. The package is actively maintained, has no known vulnerabilities, and integrates cleanly with standard observability stacks. Install it only if you have an OpenTelemetry SDK and exporter configured; it is not a standalone observability solution.
Install
opentelemetry-instrumentation-ollama on PyPI
pip
pip install opentelemetry-instrumentation-ollamauv
uv add opentelemetry-instrumentation-ollamapoetry
poetry add opentelemetry-instrumentation-ollamaInstalling opentelemetry-instrumentation-ollama
Before you install
Low friction: pure Python wheel with four stable OpenTelemetry dependencies. Actively maintained with a recent release (4 days old) and no known vulnerabilities.
License in practice
Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restrictions.
Quickstart
pip install opentelemetry-instrumentation-ollama
from opentelemetry.instrumentation.ollama import OllamaInstrumentor
OllamaInstrumentor().instrument()
Requires Python 3.10 or later; assumes an OpenTelemetry SDK and exporter are already configured in your application.
Verify before relying
- Whether the instrumentation works with all Ollama endpoint types or only a subset.
- Performance overhead of tracing on typical Ollama workloads.
- How the TRACELOOP_TRACE_CONTENT environment variable interacts with other trace filtering mechanisms.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions-ai, opentelemetry-semantic-conventions |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,879,570/month — #1,825 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_instrumentation_ollama-0.62.3-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-langchainAdds distributed tracing to Langchain LLM…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-llamaindexAdds distributed tracing to LlamaIndex…
permissive · top 5,000 on PyPI
raindrop-aiInstrument LLM applications with event tracking…
permissive · top 15,000 on PyPI
llama-index-instrumentationProvides instrumentation hooks for…
permissive · top 5,000 on PyPI
traceloop-sdkTraceloop SDK instruments LLM applications to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-haystackAdds distributed tracing to Haystack LLM…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-writerAutomatically traces calls to Writer's API…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-alephalphaAutomatically captures and traces calls to…
permissive · top 5,000 on PyPI
lumigo-tracerLumigo-tracer instruments Python Lambda…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-cohereAutomatically traces calls to Cohere's API…
permissive · top 5,000 on PyPI