Docs · Python

Python logging and alerts, in 5 minutes

Your Python app's errors with their stack trace, each request's thread across your services and a phone alert when an order never finishes. One file, no dependencies.

  1. 1

    Install

    # copy estiaje.py into your project (Python 3.8+)

    It's a ~100-line file with no dependencies: copy it from here.

  2. 2

    Your key

    Create your account and put the key in ESTIAJE_TOKEN. Or ask your AI “connect this repo to Estiaje” (the connector). Without the key nothing leaves over the network: you can instrument today.

  3. 3

    Your errors and each request's thread

    ● Tested in CI
    # miapp/middleware.py  (and in settings.MIDDLEWARE: "miapp.middleware.hilo_estiaje")
    import estiaje
    
    estiaje.capturar_errores()   # uncaught errors
    
    def hilo_estiaje(get_response):
        def middleware(request):
            estiaje.empezar_hilo(request.headers.get("traceparent"))
            return get_response(request)
        return middleware
    import estiaje
    
    estiaje.capturar_errores()   # uncaught errors
    
    @app.before_request
    def hilo_estiaje():
        estiaje.empezar_hilo(request.headers.get("traceparent"))
    from fastapi import FastAPI, Request
    import estiaje
    
    estiaje.capturar_errores()   # uncaught errors
    app = FastAPI()
    
    @app.middleware("http")
    async def hilo_estiaje(request: Request, call_next):
        estiaje.empezar_hilo(request.headers.get("traceparent"))
        return await call_next(request)
  4. 4

    The process that must finish

    estiaje.evento("order.paid", {"order_id": order.id, "amount": order.total})
    # … when it ships …
    estiaje.evento("order.shipped", {"order_id": order.id}, kind="outcome")
  5. 5

    The alert

    In the dashboard, under Processes: “every order.paid expects its order.shipped, by order_id, within 30 minutes”. If it never comes, you get a phone, email or Slack alert, with the money at risk.

And if you want more
  • Errors you catch: estiaje.error(e, {"order_id": order.id}), with their stack.
  • When calling another service, pass the thread: headers={"traceparent": estiaje.traceparent()}.
  • On FastAPI, send the event with BackgroundTasks so it goes out after responding.
  • In a lambda, estiaje.esperar() before returning.

Everything else is in the full docs.

Create account, 14 days of Pro No card required.