Skip to main content

Privacy-first, opt-in telemetry SDK for the Automagik ecosystem

Project description

Automagik Telemetry - Python SDK

📚 Complete Documentation | 🚀 Main README | ⚙️ Configuration Guide

Privacy-first OpenTelemetry SDK for Python applications with zero dependencies and 100% test coverage.

Installation

pip install automagik-telemetry

Requirements: Python 3.12+

Quick Start

from automagik_telemetry import AutomagikTelemetry, MetricType

# Initialize client
client = AutomagikTelemetry(
    project_name="my-app",
    version="1.0.0"
)

# Track events (traces)
client.track_event("user.login", {
    "user_id": "anonymous-123",
    "method": "oauth"
})

# Track metrics (counter, gauge, histogram)
client.track_metric("api.requests", value=1, metric_type=MetricType.COUNTER, attributes={
    "endpoint": "/api/users",
    "status": 200
})

Key Configuration

Batch Size (Default: batch_size=1)

# Default: Send immediately (low latency)
client = AutomagikTelemetry(project_name="my-app", version="1.0.0")

# Enable batching for high-volume apps
client = AutomagikTelemetry(
    project_name="my-app",
    version="1.0.0",
    batch_size=100  # Batch 100 events before sending
)

Backend Selection

# OTLP Backend (default - production)
client = AutomagikTelemetry(
    project_name="my-app",
    version="1.0.0",
    endpoint="https://telemetry.namastex.ai"
)

# ClickHouse Backend (self-hosting)
client = AutomagikTelemetry(
    project_name="my-app",
    version="1.0.0",
    backend="clickhouse",
    clickhouse_endpoint="http://localhost:8123"
)

Environment Variables

# Disable telemetry
export AUTOMAGIK_TELEMETRY_ENABLED=false

# Auto-disable in development
export ENVIRONMENT=development

# Custom OTLP endpoint
export AUTOMAGIK_TELEMETRY_ENDPOINT=https://your-collector.com

# ClickHouse backend
export AUTOMAGIK_TELEMETRY_BACKEND=clickhouse
export AUTOMAGIK_TELEMETRY_CLICKHOUSE_ENDPOINT=http://localhost:8123

See Configuration Guide for all options.

Development

# Install dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=automagik_telemetry --cov-report=html

# Type checking
mypy src/automagik_telemetry

# Linting
ruff check src tests

Documentation

Python-Specific Features

  • Sync and async methods: track_event() (sync) and track_event_async() (async)
  • snake_case naming: Follows PEP 8 conventions (track_event, project_name)
  • Type hints: Full type safety with mypy strict mode
  • Time units: flush_interval in seconds (float)

See SDK Differences for Python vs TypeScript comparison.

License

MIT - see LICENSE for details.

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

automagik_telemetry-0.1.1.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

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

automagik_telemetry-0.1.1-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file automagik_telemetry-0.1.1.tar.gz.

File metadata

  • Download URL: automagik_telemetry-0.1.1.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for automagik_telemetry-0.1.1.tar.gz
Algorithm Hash digest
SHA256 60b7aa0c7dd92afc2238125f65006faf36130eeb8486d81df8b6bb02af507aa0
MD5 e7f3078d5120df232139c83fc8c81ac4
BLAKE2b-256 e2bcb23dbb38ab0b5b5001652fdbf18264fd2345cd82b9911e0aefc0daafaa85

See more details on using hashes here.

File details

Details for the file automagik_telemetry-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for automagik_telemetry-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c414eb3a0f4abb278425431263a079d5763887ff5d35c870fbaeb1329e5856c
MD5 1a4e4d7120335a3051ad506a7bde5fc6
BLAKE2b-256 441a4fa8f5141c4112e6890dabf7b359d263c8993dd116e89a6d8abeb22b01b1

See more details on using hashes here.

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