Skip to main content

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ollama_telemetry-0.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ollama_telemetry-0.1.2-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

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

Hashes for ollama_telemetry-0.1.2.tar.gz
Algorithm Hash digest
SHA256 39b7f3b6a5aa1b2957a7045e777be7677260d0845be87b927900508845230d33
MD5 8aff199bfdffaae23248da94c7f680df
BLAKE2b-256 0c919da4e1121ed37d2249aaf2c9ebf3a80b07337562cf3a0e7b1a167f85f368

See more details on using hashes here.

Provenance

The following attestation bundles were made for ollama_telemetry-0.1.2.tar.gz:

Publisher: publish.yml on sanchitsinghal7/ollama-telemetry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ollama_telemetry-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ollama_telemetry-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be7cade74b62a2f25a3b418de59ded1e8ec2ef313fa859bb6327886087706c47
MD5 a686f715160f46cb9ddb14810f16259b
BLAKE2b-256 fe0653a64d0fca5b348c9cca0181fd31d866dff25c306d2c7d0f7fab3fc2eb9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ollama_telemetry-0.1.2-py3-none-any.whl:

Publisher: publish.yml on sanchitsinghal7/ollama-telemetry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page