Skip to content

feat: support for pytest-xdist traceparent propagation#1701

Merged
jirikuncar merged 6 commits intomainfrom
pytest-xdist
Feb 10, 2026
Merged

feat: support for pytest-xdist traceparent propagation#1701
jirikuncar merged 6 commits intomainfrom
pytest-xdist

Conversation

@jirikuncar
Copy link
Copy Markdown
Contributor

pytest --logfire -n auto

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Feb 10, 2026

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2a5ff05
Status: ✅  Deploy successful!
Preview URL: https://9a47b034.logfire-docs.pages.dev
Branch Preview URL: https://pytest-xdist.logfire-docs.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for running the Logfire pytest plugin under pytest-xdist by propagating trace context to worker processes and validating xdist-specific span behavior in integration tests.

Changes:

  • Add a pytest_xdist_setupnodes hook to inject TRACEPARENT/TRACESTATE into the controller environment before workers spawn.
  • Add xdist worker metadata (pytest.xdist.worker_id / pytest.xdist.worker_count) and worker-aware session span templates.
  • Update pytester-based tests to write/read per-worker span capture files and add coverage for xdist vs non-xdist behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
logfire/_internal/integrations/pytest.py Injects trace context for xdist workers and annotates session spans with xdist metadata.
tests/otel_integrations/test_pytest_plugin.py Captures spans per xdist worker and adds assertions for worker/controller span relationships and attributes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jirikuncar jirikuncar enabled auto-merge (squash) February 10, 2026 15:06
@alexmojaki alexmojaki disabled auto-merge February 10, 2026 15:07
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

@jirikuncar jirikuncar merged commit bd9e481 into main Feb 10, 2026
14 checks passed
@jirikuncar jirikuncar deleted the pytest-xdist branch February 10, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants