Repository navigation
Fix metric resource PID after fork - #2189
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change refactors 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Summary
os.fork()Root cause
MeterProviderstores the resource used during collection in_sdk_config.resource. Assigningmeter_provider._resourcecreated an unused attribute, so child metrics continued to export the parent process PID. Cached SDK tracer and logger instances also retain their original resource and need to be updated after the fork.Logfire's child callback runs before OpenTelemetry resets inherited provider locks. It therefore updates the same backing state as OpenTelemetry's private
_update_resource()methods without calling those lock-taking methods or_handle_fork(), which also reruns resource detection.Validation
uv run pytest tests/test_configure.py— 106 passeduv run pyright logfire/_internal/config.py tests/test_configure.py