Telescope integrations
Telescope for Python web frameworks and task queues.
from nexus.telescope import …Telescope for Python web frameworks and task queues.
TelescopeWSGIMiddleware— any WSGI app (Flask, Pyramid, Bottle, Falcon…)TelescopeASGIMiddleware— any ASGI app (FastAPI, Starlette, Quart, Litestar…)DjangoTelescopeMiddleware— Django (plus ORM queries and model signals)instrument_flask— names Flask routes and captures their exceptionsinstrument_celery— Celery tasks as jobs that join the dispatching trace
| Symbol | Kind | Summary |
|---|---|---|
TelescopeWSGIMiddleware | class | app.wsgi_app = TelescopeWSGIMiddleware(app.wsgi_app, telescope). |
TelescopeASGIMiddleware | class | app.add_middleware(TelescopeASGIMiddleware) (FastAPI/Starlette) or app = TelescopeASGIMiddleware(app). |
DjangoTelescopeMiddleware | class | Add "nexus.telescope.integrations.DjangoTelescopeMiddleware" FIRST in MIDDLEWARE. |
instrument_flask() | function | instrument_flask(app): wraps app.wsgi_app and adds route names, the parsed body, the user (flask-login) and exception capture. |
instrument_celery() | function | Celery tasks as Telescope jobs. |
TelescopeWSGIMiddleware
classapp.wsgi_app = TelescopeWSGIMiddleware(app.wsgi_app, telescope).
TelescopeWSGIMiddleware
constructorTelescopeWSGIMiddleware(app, telescope=None)Parameters
Prop
Type
TelescopeASGIMiddleware
classapp.add_middleware(TelescopeASGIMiddleware) (FastAPI/Starlette) or app = TelescopeASGIMiddleware(app).
TelescopeASGIMiddleware
constructorTelescopeASGIMiddleware(app, telescope=None)Parameters
Prop
Type
DjangoTelescopeMiddleware
classAdd "nexus.telescope.integrations.DjangoTelescopeMiddleware" FIRST in
MIDDLEWARE. Records the request, every ORM query (with N+1 detection),
model saves/deletes, exceptions and logs. Configure with NEXUS = {...}
in settings (TELESCOPE sub-dict for Telescope options).
DjangoTelescopeMiddleware
constructorDjangoTelescopeMiddleware(get_response)Parameters
Prop
Type
process_exception()
methoddef process_exception(request, exception) -> NoneParameters
Prop
Type
Functions
instrument_flask()
functiondef instrument_flask(app, telescope=None) -> Anyinstrument_flask(app): wraps app.wsgi_app and adds route names,
the parsed body, the user (flask-login) and exception capture.
Parameters
Prop
Type
Returns Any
instrument_celery()
functiondef instrument_celery(telescope=None) -> NoneCelery tasks as Telescope jobs. Call once, e.g. in your celery.py.
Publishing a task records a job entry in the current journey and puts a
traceparent in the message headers; the worker's run joins that trace.
Parameters
Prop
Type
