feat: Add Correlation ID for CHAIN & LLM Traces in ArizePhoenixTracer Integration by ialisaleh · Pull Request #10813 · langflow-ai/langflow (original) (raw)
Important
Review skipped
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Walkthrough
This PR enhances Arize Phoenix tracing integration by introducing a CollectingSpanProcessor to manage correlation IDs, modifying ArizePhoenixTracer to accept session management, enriching spans with structured metadata attributes, and adding explicit cleanup mechanisms.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
| Arize Phoenix Tracing Enhancements src/backend/base/langflow/services/tracing/arize_phoenix.py | Introduces CollectingSpanProcessor class to inject correlation IDs into spans on creation. Modifies ArizePhoenixTracer constructor to accept session_id parameter. Expands span attributes with langflow metadata (trace_name, trace_type, project_name, trace_id, session_id, flow_name, flow_id). Changes root span name from flow_id to "Langflow". Adds vertex_id attribute to child spans. Updates span end logic to use explicit end_time timestamps. Improves error logging with [Arize/Phoenix] prefix. Adds close() and \_\_del\_\_() methods for tracer cleanup and span flushing. Adds import for SpanProcessor from opentelemetry.sdk.trace.export. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20–25 minutes
- CollectingSpanProcessor logic: Verify correlation ID generation and span attribute injection patterns
- Session ID handling: Confirm session_id is properly threaded through constructor and stored/used consistently
- Span attribute semantics: Review newly added langflow metadata attributes for correct naming and value assignments
- Cleanup mechanism: Ensure
close()and\_\_del\_\_()methods reliably flush spans and handle errors gracefully
Pre-merge checks and finishing touches
Important
Pre-merge checks failed
Please resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 warnings, 3 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
| Test Quality And Coverage | ⚠️ Warning | PR introduces significant new functionality but lacks comprehensive test coverage for critical issues identified in review including thread-safety concerns and error handling. | Add pytest test cases covering thread-safety, correlation_id lifecycle, error handling, and all trace attribute injection scenarios to dedicated test_arize_phoenix.py file. |
| Test Coverage For New Implementations | ❓ Inconclusive | Unable to access repository to verify test coverage due to technical constraints with clone operation. Analysis cannot be completed without examining repository structure and identifying test files. | Manually verify test coverage by accessing the repository directly to check for test files matching test_arize_phoenix.py or test_ tracing.py patterns and review coverage of new functionality. |
| Test File Naming And Structure | ❓ Inconclusive | Unable to directly access repository structure to verify test files were added for ArizePhoenixTracer integration changes. | Provide confirmation of test file additions, names, locations, and verification of pytest coverage for new functionality. |
| Excessive Mock Usage Warning | ❓ Inconclusive | Cannot assess excessive mock usage in tests without repository access to analyze test files and mock patterns. | Repository access needed to examine test files for ArizePhoenixTracer and CollectingSpanProcessor classes and evaluate mock appropriateness. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: adding a correlation ID mechanism for CHAIN & LLM traces in the ArizePhoenixTracer integration, which aligns with the PR's core objective of improving cross-span observability. |
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.