Django
Keep the client in a small server-only module and import it from views, services, or signal handlers:myapp/repost.py
atexit is a process fallback. When your WSGI or ASGI server exposes worker lifecycle hooks, create and close the client in those hooks instead. Each worker process owns its own instance.
If AppConfig.ready() wires Django signals, guard against the development autoreloader registering them twice. Do not perform sends or other network work from ready().
Flask
Create the client next to the application, then expose it throughapp.extensions for handlers and services:
FastAPI
Python sends are synchronous in0.4. Own the client with the application lifespan and call generated methods through Starlette’s thread pool so an async route does not block the event loop:
Trace parenting
Configuretelemetry() once when you construct the client. It captures the current OpenTelemetry context for every send, so repost.send becomes a child of the active inbound request span. Standard Django, Flask, and FastAPI OpenTelemetry middleware can provide that parent. The SDK does not install middleware or global instrumentation.
Continue
Compatibility & security
Review supported interpreters, dependencies, threading, and credential boundaries.
Configuration
Build the options owned by your application lifecycle.
Observability
Wire metrics and tracing without global instrumentation.