Repository navigation
fix: enrich Flask, ASGI, and Celery spans with context - #1075
Open
pauldambra wants to merge 6 commits into
Open
pauldambra wants to merge 6 commits into
pauldambra wants to merge 6 commits into
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-18T10:56:29.007936+00:00 ✅ All Tests Passed!121/121 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
pauldambra
added this pull request to stack #1076
October 17, 2026 08:57
1 of 52 tasks
3 of 5 tasks
pauldambra
force-pushed
the
posthog/flask-otel-span-context
branch
from
October 17, 2026 14:08
9192353 to
dea8a0c
Compare
pauldambra
marked this pull request as ready for review
October 17, 2026 14:44
Member
Author
|
Note 🤖 Automated comment by QA Swarm — not written by a human Verdict: ✅ APPROVE (privacy round @ 4362c0d)Restacked on the client-owner fix in #1070. Test fixtures now use enabled clients, because a bare mock client or a missing key counts as disabled. ChecksFull test suite (4,794 passed), Ruff, and CI mypy pass. Earlier roundsVerdict: ✅ APPROVE (round 1 @ d157e4a)No remaining actionable finding in the reviewed change. The bounded Celery follow-up checked exact task ownership before current-span enrichment. The documented instrumentation order remains required. Key findings
ConvergenceNo remaining duplicate finding. Reviewer summaries
Automated by QA Swarm. Human review is required. This comment does not approve a merge or release. |
Generated-By: PostHog Desktop Task-Id: 5681be44-4986-48db-b140-1bda88f75f96
Generated-By: PostHog Desktop Task-Id: 5681be44-4986-48db-b140-1bda88f75f96
Generated-By: PostHog Desktop Task-Id: 5681be44-4986-48db-b140-1bda88f75f96
Generated-By: PostHog Desktop Task-Id: 5681be44-4986-48db-b140-1bda88f75f96
Generated-By: PostHog Desktop Task-Id: 5681be44-4986-48db-b140-1bda88f75f96
Generated-By: PostHog Desktop Task-Id: bfd18848-e498-4352-a58a-b9ba85de4198
pauldambra
force-pushed
the
posthog/flask-otel-span-context
branch
from
October 18, 2026 10:51
d157e4a to
4362c0d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Robot] Prepared with PostHog Desktop on behalf of @pauldambra.
💡 Motivation and Context
Flask, FastAPI/ASGI, and Celery users need backend spans to carry the session and person IDs from the request or job. An application span can start before PostHog reads those IDs.
Builds on the shared optional bridge in #1070. Tracks sdk-specs#128.
Each existing integration now calls the shared bridge after it sets the request or task context. The optional processor handles child spans. Explicit span attributes, application identity, and the current tracing-header capture settings are preserved. No new public API or production dependency is added.
The setup reference covers middleware order and cleanup. Celery must be initialized before OpenTelemetry Celery instrumentation for eager or nested execution. Existing spans receive job IDs only when their public Celery task ID matches the current job. Spans created by outer FastAPI error handling after the PostHog scope ends can omit request IDs.
💚 How did you test it?
📝 Checklist
If releasing new changes
sampo addto generate a changeset fileAdded patch changesets in the documented Sampo format.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Model: GPT-6 (Codex), through PostHog Desktop. Separate framework agents checked Flask, ASGI/FastAPI, and Celery. Used the GitHub CLI and local Python tools. The changes reuse one shared bridge and keep the Python stack to two layers.
Created with PostHog Desktop