Repository navigation
fix(telemetry): allow Python SDK initialization from worker threads - #4971
DivyamTalwar wants to merge 1 commit into
Conversation
|
@DivyamTalwar is attempting to deploy a commit to the Latitude Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
All contributors have signed the CLA ✍️ ✅ |
|
Thanks for this, @DivyamTalwar! Allowing the Python SDK to initialize from worker threads is a useful fix, and Codex didn't flag anything. One thing before we can move forward: please sign the CLA by posting a comment with exactly |
|
I have read the CLA Document and I hereby sign the CLA |
The Python telemetry SDK can attach its exporter and then fail during construction because Python only permits signal registration on the main thread. Register the process exit callback once from either thread. If initialization later runs on the main thread, install the original signal handlers using the same first shutdown owner.
A fresh interpreter reproduced the failure while creating Latitude from a real worker thread. The patched subprocess exports a span and verifies a later main-thread initialization retains the first shutdown owner. An independent concurrent run also verified one exit callback and one SIGINT/SIGTERM registration across worker and main initializations.
All 145 telemetry tests passed on the locked Python 3.12 environment. Ruff, targeted Pyright, and the diff check passed. Tests used local in-memory exporters.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.