All Integrations
Languagestigerops Python SDK

Python Integration

Instrument Django, FastAPI, Flask, and bare Python apps with a single pip install. Full async support, Celery task tracing, and database query visibility included.

Setup

How It Works

01

pip install tigerops

Install the TigerOps Python SDK. It bundles the OpenTelemetry Python SDK with auto-instrumentation packages for Django, Flask, FastAPI, SQLAlchemy, Redis, and Celery.

02

Add Middleware

For Django: add TigerOpsMiddleware to MIDDLEWARE. For FastAPI: use app.add_middleware(TigerOpsMiddleware). For Flask: use TigerOps(app). One line of code per framework.

03

Configure via Environment

Set TIGEROPS_API_KEY, TIGEROPS_SERVICE_NAME, and TIGEROPS_ENVIRONMENT. All other settings have sensible defaults. The SDK auto-detects your framework and configures accordingly.

04

Python Metrics & Traces Flow In

TigerOps begins receiving request traces, database query spans, Celery task events, Redis operations, and Python runtime metrics (GC counts, thread counts) within seconds.

Capabilities

What You Get Out of the Box

Django Auto-Instrumentation

Automatic tracing for Django views, middleware, ORM queries (with SQL text), cache operations, and Celery tasks. Supports both sync and async Django views.

FastAPI & ASGI Support

Full async/await trace propagation for FastAPI and Starlette. Background tasks, WebSocket connections, and dependency injection chains are all traced correctly.

Flask Instrumentation

Request lifecycle tracing, SQLAlchemy query capture, blueprint-level spans, and before/after request hook visibility for Flask applications.

SQLAlchemy & Database Queries

Per-query spans with normalized SQL text, execution time, and row counts for SQLAlchemy, psycopg2, pymysql, and pymongo. N+1 detection built in.

Celery Task Monitoring

Task queue depth, worker utilization, task duration, retry counts, and failure rates. Trace context propagates from the request that enqueued the task to the worker.

Python Runtime Metrics

CPython GC collection counts, memory RSS, thread count, and open file descriptors. TigerOps alerts on memory growth patterns indicative of leaks.

Configuration

pip install + Middleware Setup

Install TigerOps and add one line per framework. No additional configuration required.

terminal + framework examples
# Install TigerOps Python SDK
pip install tigerops

# Environment variables
export TIGEROPS_API_KEY="your-api-key"
export TIGEROPS_SERVICE_NAME="my-python-service"
export TIGEROPS_ENVIRONMENT="production"

---
# Django — settings.py
MIDDLEWARE = [
    'tigerops.django.TigerOpsMiddleware',   # Add first
    'django.middleware.security.SecurityMiddleware',
    # ... rest of middleware
]

INSTALLED_APPS = [
    'tigerops.django',  # Required for management commands
    # ... your apps
]

# Optional: configure in settings
TIGEROPS = {
    'trace_db_queries': True,
    'trace_cache_ops': True,
    'sample_rate': 1.0,  # 100% in production, reduce for high-traffic
}

---
# FastAPI — main.py
from fastapi import FastAPI
from tigerops.fastapi import TigerOpsMiddleware

app = FastAPI()
app.add_middleware(TigerOpsMiddleware)

@app.get("/items/{item_id}")
async def read_item(item_id: int):
    # This span is automatically created and linked to the request
    item = await db.fetch_one("SELECT * FROM items WHERE id = :id", {"id": item_id})
    return item

---
# Flask — app.py
from flask import Flask
from tigerops.flask import TigerOps

app = Flask(__name__)
TigerOps(app)   # That's it

@app.route('/health')
def health():
    return {'status': 'ok'}
FAQ

Common Questions

Does TigerOps support async Python frameworks like FastAPI and async Django?

Yes. The TigerOps Python SDK uses asyncio-native context propagation. async/await trace context flows correctly through FastAPI routes, async Django ORM queries, and aiohttp client requests without any additional configuration.

Can I use TigerOps alongside existing OpenTelemetry Python instrumentation?

Yes. TigerOps Python is built on the OpenTelemetry Python SDK. If you already have OTel configured, set the OTEL_EXPORTER_OTLP_ENDPOINT environment variable to your TigerOps OTLP endpoint and all existing instrumentation will send data to TigerOps.

Does TigerOps support Pydantic v2 and the new Django 5.x async views?

Yes. The SDK is tested against Django 4.2 LTS, Django 5.x, FastAPI 0.100+, and Flask 3.x. Pydantic v2 is supported through the FastAPI instrumentation layer. The SDK is updated within two weeks of major framework releases.

How does TigerOps instrument third-party HTTP clients in Python?

The SDK auto-instruments requests, httpx, and aiohttp for outbound HTTP calls. Each outbound request becomes a child span with URL, method, status code, and duration. W3C traceparent headers are injected automatically to propagate context downstream.

Can I trace Celery tasks that span multiple queues and workers?

Yes. TigerOps serializes the trace context into the Celery task headers when the task is enqueued. When the worker picks up the task, it deserializes the context and creates child spans linked to the original request trace — across any number of queues and workers.

Get Started

Instrument Your Python Services Today

One pip install. Django, FastAPI, or Flask — all supported. Full traces in under 5 minutes.