Skip to content
CloseYourItdocsPages

Documentation / Connect / Connect your apps

Python Pre-alpha

The closeyourit package sends errors, logs and metrics from server-side Python applications.

What it collects

  • unhandled errors;
  • logs, from Python's standard logging;
  • duration metrics, with measure();
  • slow queries, with SQLAlchemy;
  • the duration of Celery tasks;
  • usage telemetry, if you turn it on.

It has integrations for Django, Flask, WSGI, ASGI, Celery, HTTP and SQLAlchemy. Version 0.4.0 also adds Django query monitoring and explicit FastAPI/Starlette adapters.

What you need

  • Python 3.11 or newer.

Install

pip install closeyourit

Integrations are installed one by one:

pip install "closeyourit[django]"
pip install "closeyourit[flask]"
pip install "closeyourit[celery]"

Configure

It reads these variables from the application's environment:

VariableWhat it is for
CLOSEYOURIT_ENDPOINT_URLthe address of your installation
CLOSEYOURIT_TOKENthe secret token, server side only
CLOSEYOURIT_PROJECT_IDthe project id
CLOSEYOURIT_ENVIRONMENTthe environment
CLOSEYOURIT_RELEASEthe version of the app

If something is missing the SDK turns itself off, without raising an error.

New framework adapters

Version 0.4.0 adds opt-in DjangoMiddleware(query_monitoring=True) and reversible instrument_django(client) query profiles. FastAPI and Starlette use instrument_fastapi(api, client) or instrument_starlette(api, client); export the returned wrapper to the ASGI server. Install before serving and call uninstall() to remove the integration. The application remains responsible for closing its client.

These additions have local framework and delivery tests, not a publication guarantee. Use the README for the exact installed version. Server-side OpenTelemetry is a separate path; native duration metrics are not OTLP traces.