Skip to main content

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 ChatOllama auto-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.

Metadata

Release files for ollama-telemetry 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ollama-telemetry 0.1.2
File Size Uploaded
ollama_telemetry-0.1.2.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ollama-telemetry 0.1.2
File Interpreter ABI Platform
ollama_telemetry-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / ollama_telemetry-0.1.2.tar.gz

Download URL ollama_telemetry-0.1.2.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
39b7f3b6a5aa1b2957a7045e777be7677260d0845be87b927900508845230d33
BLAKE2b-256 checksum
How to use checksums
0c919da4e1121ed37d2249aaf2c9ebf3a80b07337562cf3a0e7b1a167f85f368
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release files / ollama_telemetry-0.1.2-py3-none-any.whl

Download URL ollama_telemetry-0.1.2-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be7cade74b62a2f25a3b418de59ded1e8ec2ef313fa859bb6327886087706c47
BLAKE2b-256 checksum
How to use checksums
fe0653a64d0fca5b348c9cca0181fd31d866dff25c306d2c7d0f7fab3fc2eb9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page