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
- Getting Started - Complete setup guide
- Configuration - All configuration options
- Backends Guide - OTLP vs ClickHouse comparison
- API Reference - Complete API documentation
- SDK Differences - Python vs TypeScript
- Troubleshooting - Common issues and solutions
Python-Specific Features
- Sync and async methods:
track_event()(sync) andtrack_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_intervalin 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
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 automagik_telemetry-0.1.3.tar.gz.
File metadata
- Download URL: automagik_telemetry-0.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd13ed9a8931da39764e449ab34dff2a883ca419db3664bcc4224d66faca670a
|
|
| MD5 |
9e912bae6c698cecf835c3e8bc0c6ce0
|
|
| BLAKE2b-256 |
55e11d635914de2d3428c6b3c4217374d4f083ccfa67d934026fc6d9eb2cf2bc
|
File details
Details for the file automagik_telemetry-0.1.3-py3-none-any.whl.
File metadata
- Download URL: automagik_telemetry-0.1.3-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab89651ec28727f0c7ba6f38b203ae5d44f2715b69047c3fd9d08048fa6f9443
|
|
| MD5 |
3dc11810946a7c866a123a11f2bcf54f
|
|
| BLAKE2b-256 |
3a84b0193ae03f7c83bed4338f49ba826900322fafe6823bc486c8227be0f8eb
|