-
[OPIK-6169][SDK] Python and TypeScript SDKs expose a helpers for handling distributed trace headers in OpenTelemetry (#6481)
发布于
2026-04-29 11:54:19 +00:00 - [OPIK-6169][BE] Add helper functions for handling Opik distributed trace attributes and relevant unit tests.
- Introduced
OpikDistributedTraceAttributesclass to manage trace ID and parent span ID. - Added helper functions
extract_opik_distributed_trace_attributesandattach_to_parent. - Created comprehensive unit tests to validate trace attribute extraction and attachment logic.
- [OPIK-6169][SDK] Refactor OTEL helper functions and tests for improved modularity.
- Moved helper functions
extract_opik_distributed_trace_attributesandattach_to_parentto the newdistributed_tracemodule. - Updated imports in unit tests and modules to reflect the refactor.
- Reorganized type references using
otel_typesfor consistency.
- [OPIK-6169][SDK] Refactor OTEL helper functions and tests for improved modularity.
- Moved helper functions
extract_opik_distributed_trace_attributesandattach_to_parentto the newdistributed_tracemodule. - Updated imports in unit tests and modules to reflect the refactor.
- Reorganized type references using
otel_typesfor consistency.
- [OPIK-6169][SDK] Add E2E test for OTel distributed tracing with Opik backend integration.
- Validates end-to-end trace creation, spanning, and parent-child link verification between Service A and Service B using Opik OTLP.
- Ensures spans appear correctly in the Opik backend.
- [OPIK-6169][SDK] Add test dependencies and update E2E workflow for Python SDK.
- Introduced
test_requirements.txtto manage additional dependencies for Python SDK E2E tests. - Updated GitHub Actions workflow to install new E2E test requirements.
-
[OPIK-6169][SDK] Update OTEL exporter to handle dynamic endpoint paths based on URL override.
-
[OPIK-6169][SDK] Restructure Python SDK E2E tests for OpenTelemetry integration.
- Moved OpenTelemetry-specific requirements and tests to a dedicated directory.
- Updated GitHub Actions workflows to include OpenTelemetry library tests.
- Removed redundant test requirements and adjusted imports for modularity.
-
[OPIK-6169][SDK] Update OTEL exporter to derive endpoint paths based on parsed port from the URL override.
-
[OPIK-6169][SDK] Add TypeScript helper functions for OTel distributed tracing with unit tests.
- Introduced
OpikDistributedTraceAttributesclass for managing trace ID and parent span ID. - Added
extractOpikDistributedTraceAttributesandattachToParentutility functions. - Implemented comprehensive unit tests to validate trace attribute extraction and attachment logic.
- Updated TypeScript exports for integration with Opik distributed tracing functionalities.
- [OPIK-6169][SDK] Enhance Opik distributed trace attribute handling with validation and logging.
- Implemented UUID validation and logging for
extract_opik_distributed_trace_attributesandattach_to_parentin Python and TypeScript SDKs. - Added tests for invalid, missing, and whitespace-only trace IDs and parent span IDs.
- Improved handling of case-insensitive headers and trimmed attribute values.
- [OPIK-6169][SDK] Refactor Opik distributed trace context handling.
- Moved header definitions and context-related logic to a new
context.tsmodule. - Updated imports and restructured exports for better modularity and separation of concerns.
- [OPIK-6169][Docs] Add guidance for linking OpenTelemetry spans to existing Opik traces and distributed tracing examples.
- Documented header propagation (
opik_trace_id,opik_parent_span_id) and Opik bridging helper usage. - Included Python and TypeScript examples for client-side trace emission and remote service span attachment.
- Expanded "Distributed Traces with a Remote Service Using OpenTelemetry" section with detailed instructions.
- [OPIK-6169][SDK] Add unit tests for TypeScript distributed tracing context.
- Introduced tests for
context.tsto validate header constants and distributed trace header behavior. - Verified header extraction using
trackStorageand context store scenarios ingetDistributedTraceHeaders.
- [OPIK-6169][SDK] Refactor OpenTelemetry integration package structure.
- Moved
opik.otelmodules toopik.integrations.otelfor better organization. - Updated imports across tests and source code to reflect the new structure.
- [OPIK-6169][SDK] Add UUIDv7 validation, update tests, and refactor distributed trace integration.
- Introduced
is_valid_uuid_v7function inid_helpersfor UUIDv7 validation. - Updated distributed trace logic to use
is_valid_uuid_v7for header validation. - Added comprehensive unit tests for
is_valid_uuid_v7covering valid, invalid, and malformed inputs. - Refactored imports and removed redundant
_is_valid_uuidutility in distributed tracing module. - Updated documentation to reflect import changes in integration examples.
- [OPIK-6169][SDK] Add UUIDv7 validation to TypeScript, refactor imports, and expand tests.
- Introduced
isValidUuidV7utility in TypeScript for UUIDv7 validation. - Updated distributed trace logic to use
isValidUuidV7for trace ID and parent span ID validation. - Added comprehensive unit tests for
isValidUuidV7and updated distributed trace tests for non-v7 UUID handling. - Refactored imports across affected modules for consistency.
- [OPIK-6169][Backend] Add
opik.span_idattribute override handling in OpenTelemetry mappings and tests.
- Introduced
opik.span_idas a new attribute with mapping rule to handle span ID overrides. - Updated
OpenTelemetryMapperto supportopik.span_idfor UUIDv7-based span ID overrides. - Added comprehensive unit tests verifying
opik.span_idextraction, override, and chaining logic. - Ensured
opik.span_idis dropped from final attributes to prevent redundancy.
- [OPIK-6169][P SDK] Add
OpikSpanProcessorto propagate trace context and extend UUIDv7 chaining.
- Introduced
OpikSpanProcessorfor automating trace context propagation across OTel spans. - Ensured UUIDv7-based
opik.span_idandopik.parent_span_idchaining across descendant spans. - Updated
attach_to_parentto mint boundaryopik.span_idfor consistent linking. - Added unit and E2E tests to validate correct span inheritance and linkage.
- Refactored attribute handling into
attributes.pyfor improved reusability and clarity.
- [OPIK-6169][TS SDK] Add
OpikSpanProcessorfor automated Opik trace attribute propagation.
- Introduced
OpikSpanProcessorto automateopik.trace_id,opik.span_id, andopik.parent_span_idpropagation across OTel spans. - Minted
opik.span_idfor boundary spans to enable consistent descendant chaining with UUIDv7-based linking. - Refactored trace attribute handling into reusable constants (
attributes.ts) for clarity. - Enhanced unit tests to validate inheritance from parent spans and baggage, ensuring correct trace context propagation.
- [OPIK-6169][Docs] Add
OpikSpanProcessorsetup instructions for OpenTelemetry spans and subtree propagation.
- Documented
OpikSpanProcessorregistration to propagate Opik trace attributes to descendant spans. - Updated Python and TypeScript examples for accurate trace context inheritance.
- Clarified boundary span behavior and subtree propagation mechanics.
- Enhanced guidance for OpenTelemetry integration with Opik.
-
[OPIK-6169][TS SDK] Moved Opik OpenTelemetry integration and tests into separate package.
-
[OPIK-6169][P SDK] Add logging for invalid Opik context during span propagation.
- Introduced
LOGGERfor enhanced debugging of invalidopik.trace_idandopik.span_idduring context inheritance. - Updated
is_valid_uuid_v7to useTypeGuardfor improved type safety and validation accuracy. - Refined error handling to ensure graceful fallback and detailed warning messages for invalid contexts.
- Updated a test to mark it for future re-enablement after backend readiness.
-
[OPIK-6169][TS SDK] Updated package-lock.json to use opik 2.0.15
-
[OPIK-6169][Docs] Refine TypeScript example to illustrate context management and correct boundary span setup.
-
[OPIK-6169][TS SDK] Add validation and logging for inherited Opik context during span propagation.
- Introduced strict UUIDv7 validation for
opik.trace_idandopik.span_idin both parent span attributes and baggage. - Added detailed
logger.warnmessages for invalid or missing IDs to improve debugging of misconfigured upstreams. - Refined
isValidUuidV7as a type predicate for enhanced type safety in callers. - Ensured graceful fallback to avoid propagating invalid Opik contexts.
下载附件