Privacy-first, SQLite-first observability for local Ollama agents.
Project description
ollama-telemetry
Privacy-first, SQLite-first observability for local Ollama agents.
- Stores telemetry locally in SQLite by default.
- Never stores prompts, completions, message bodies, or raw response payloads.
- No cloud account, API key, network service, or proprietary agent integration required.
- Captures Ollama token counts and latency fields when available.
- Supports explicit tracing and optional
ChatOllamaauto-instrumentation.
Package name availability on PyPI must be checked before publishing.
Install
pip install ollama-telemetry
For LangChain / ChatOllama:
pip install "ollama-telemetry[langchain]"
Zero-code-ish LangChain setup
from ollama_telemetry import enable
enable(auto_instrument_langchain=True)
# Existing ChatOllama code can run after this point.
Auto instrumentation is opt-in and intentionally marked as a convenience mode. The explicit API below is the recommended production approach.
Explicit tracing
telemetry.agent(...) works as either a decorator or a context manager. Both forms create one root trace.
from ollama_telemetry import telemetry
from ollama_telemetry.integrations.langchain import OllamaTelemetryCallback
from langchain_ollama import ChatOllama
telemetry.init()
@telemetry.agent(name="research_agent", workflow="summarization")
def run(document_id: str, messages):
llm = ChatOllama(
model="qwen3:8b",
callbacks=[OllamaTelemetryCallback()],
)
with telemetry.context(entity_type="document", entity_id=document_id):
return llm.invoke(messages)
Direct Ollama response capture
from ollama_telemetry import telemetry
from ollama import chat
telemetry.init()
with telemetry.agent("local_research_agent"):
response = chat(
model="qwen3:8b",
messages=[{"role": "user", "content": "Summarize this."}],
)
telemetry.capture_ollama_response(response, model="qwen3:8b")
Database
Default location:
~/.ollama-telemetry/telemetry.db
Override it:
export OLLAMA_TELEMETRY_DB=/path/to/telemetry.db
The SQLite table is telemetry_events. It stores identifiers, timing, model, status, safe usage counters, and JSON metadata. It does not store content fields.
CLI
ollama-telemetry status
ollama-telemetry stats --last 7d
ollama-telemetry models --last 30d
ollama-telemetry agents --last 30d
ollama-telemetry traces --failed
ollama-telemetry prune --older-than 30d
ollama-telemetry vacuum
Privacy guarantees
The package rejects sensitive metadata keys such as prompt, completion, messages, response, content, and raw_response. Safe metadata is limited to scalar values and small lists/dictionaries after recursive filtering.
Development
python -m pip install -e ".[dev]"
pytest
python -m build
License
Apache-2.0.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ollama_telemetry-0.1.2.tar.gz.
File metadata
- Download URL: ollama_telemetry-0.1.2.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39b7f3b6a5aa1b2957a7045e777be7677260d0845be87b927900508845230d33
|
|
| MD5 |
8aff199bfdffaae23248da94c7f680df
|
|
| BLAKE2b-256 |
0c919da4e1121ed37d2249aaf2c9ebf3a80b07337562cf3a0e7b1a167f85f368
|
Provenance
The following attestation bundles were made for ollama_telemetry-0.1.2.tar.gz:
Publisher:
publish.yml on sanchitsinghal7/ollama-telemetry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ollama_telemetry-0.1.2.tar.gz -
Subject digest:
39b7f3b6a5aa1b2957a7045e777be7677260d0845be87b927900508845230d33 - Sigstore transparency entry: 1941781951
- Sigstore integration time:
-
Permalink:
sanchitsinghal7/ollama-telemetry@119d4f70d61abfd119673f9c255b2b09627334bf -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/sanchitsinghal7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@119d4f70d61abfd119673f9c255b2b09627334bf -
Trigger Event:
push
-
Statement type:
File details
Details for the file ollama_telemetry-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ollama_telemetry-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be7cade74b62a2f25a3b418de59ded1e8ec2ef313fa859bb6327886087706c47
|
|
| MD5 |
a686f715160f46cb9ddb14810f16259b
|
|
| BLAKE2b-256 |
fe0653a64d0fca5b348c9cca0181fd31d866dff25c306d2c7d0f7fab3fc2eb9b
|
Provenance
The following attestation bundles were made for ollama_telemetry-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on sanchitsinghal7/ollama-telemetry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ollama_telemetry-0.1.2-py3-none-any.whl -
Subject digest:
be7cade74b62a2f25a3b418de59ded1e8ec2ef313fa859bb6327886087706c47 - Sigstore transparency entry: 1941782135
- Sigstore integration time:
-
Permalink:
sanchitsinghal7/ollama-telemetry@119d4f70d61abfd119673f9c255b2b09627334bf -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/sanchitsinghal7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@119d4f70d61abfd119673f9c255b2b09627334bf -
Trigger Event:
push
-
Statement type: