Telescope for Python
Django, Flask, FastAPI / Starlette, Celery and any WSGI or ASGI app — with requests, httpx, SQLAlchemy, redis-py and logging instrumented.
Install & init
pip install inverge-nexusimport nexus.telescope as telescope
telescope.init(api_key=os.environ["NEXUS_API_KEY"], service="orders-api")init() also instruments requests and httpx (sync and async, adding a
traceparent), SQLAlchemy, redis-py and the logging module. Pass
instrument=False to skip that, or an existing NexusClient as client=.
Add your framework
NEXUS = {"API_KEY": env("NEXUS_API_KEY"), "TELESCOPE": {"SERVICE": "orders-api"}}
MIDDLEWARE = [
"nexus.telescope.integrations.DjangoTelescopeMiddleware", # first
# …
]ORM queries and model saves are recorded too.
Your own work
tel = telescope.get()
with tel.span("price lookup"): # nests correctly across await
quote = pricing.quote(order)
@tel.traced()
def rebuild_index(): ...
with tel.command("reports:daily"):
run_report()
payload = {"order": 7, **tel.inject("send_invoice", "emails")} # producer
with tel.job("send_invoice", carrier=payload): # worker
send_invoice(payload)
tel.query("select …", [7], duration_ms=1.2, connection="clickhouse")
tel.user(user.id, email=user.email)
tel.tag("vip")Context lives on contextvars — correct per thread and per asyncio task.
Options
telescope.init(..., **options):
| Option | Default |
|---|---|
service | NEXUS_SERVICE_NAME |
release | NEXUS_RELEASE, else the client's release |
sample_rate | NEXUS_TELESCOPE_SAMPLE_RATE, else the console's |
ignore_paths | /health*, /healthz, /favicon.ico, /static/* |
ignore_types, redact_keys | — |
capture_bodies, body_size_limit | True, 64 KB |
max_entries | 2000 |
flush_interval | 2.0 s |
enabled | True (also NEXUS_TELESCOPE_ENABLED=false) |
Delivery runs on a fork-safe background thread; tel.flush() waits for
in-flight journeys (call it at the end of scripts).
Telescope for Node.js
One init() call records every incoming request for Express, Fastify, Koa, NestJS, Hapi and Next.js — plus outgoing calls, queries, logs and jobs.
Telescope for .NET
Request-journey tracing on System.Diagnostics.Activity — ASP.NET Core, message consumers, HttpClient, EF Core, SqlClient, Npgsql and ILogger.
