Patch changes
- Updated dependencies: posthog@7.71.0
npx @buildinternet/releases get posthog-pythonAdds capture_tracing_headers and POSTHOG_MW_CAPTURE_TRACING_HEADERS to ASGI, Flask, and Django integrations, enabled by default once an integration is installed, with trust-named options kept as deprecated aliases and explicit opt-outs honored. Header sanitization and request-context attribution are now shared across integrations, and docs clarify when to flush reusable clients versus shut down disposable ones.
Cancelled async LLM calls are now marked as errors while the cancellation itself is preserved.
Prompts.get() now makes a single request when several threads ask for the same prompt at once, with the other threads waiting on that result. With capture_errors=True, a shared failure is reported once instead of once per thread.
PostHogSpanProcessor now attaches the active PostHog context to exported AI spans: the distinct ID from identify_context, the session ID from set_context_session as $session_id, and context tags as properties. Request middleware tags like email, $ip, $user_agent, and $current_url now appear on AI events, so apps using the Django, Flask, or ASGI request middleware get AI events attributed to the context's person after upgrading.
client.metrics now attaches a trace exemplar to each series it flushes: a sample recorded inside a sampled PostHog start_span span or the current OpenTelemetry span stamps its data point with that span's trace ID, span ID, and value, linking metric charts to a representative trace. One exemplar per series per flush window, with the last sample winning.
ASGI and Flask now default to inheriting the effective client's exception-autocapture setting, with explicit capture overrides and context-only operation. Flask and Django now require opt-in to accept PostHog tracing identity and session headers, and Django gains property-named settings and extraction methods while preserving legacy aliases.
Events originating from MCP servers now have their $mcp_interface property set to mcp.
A Django REST Framework error-only exception handler captures handled 5xx API exceptions while preserving DRF responses; expected 4xx errors stay excluded by default. It inherits Django middleware, client, request-filter, and exception-autocapture configuration.
New framework-independent ASGI middleware captures request context and unhandled exceptions, supporting FastAPI, Starlette, Litestar, WebSockets, and sync or async filters without a framework dependency. A Flask integration is also added for isolated request contexts and automatic exception capture, plus resolve_original_tool for low-level MCP servers to strip PostHog-owned arguments before strict tool validation.
Exception capture metadata is standardized across severity, capture source, typed integration metadata, mechanism semantics, bounded exception-group traversal, and deterministic cause linkage. Application overrides of reserved exception properties still work during a deprecation period but now emit a warning and will be removed in the next major version.