-
[OPIK-2856] [SDK] Fix demo data span time shifts to match traces (#3991)
发布于
2025-11-11 10:50:24 +00:00 - [OPIK-2856] [SDK] Fix demo data span time shifts to match traces
- Fixed critical bug where spans had different time shifts than their parent traces
- Extracted trace processing into reusable process_traces_with_time_shift() function
- Extracted span processing into reusable process_spans_with_time_shift() function
- Calculate time shift from traces only, then reuse same shift for spans
- Apply identical time shift to all traces and spans to preserve time distances
- Demo traces from 2025-07-28 to 2025-08-27 now shift correctly to present time
- Demo spans from 2025-08-27 shift to same date as latest trace (2025-11-07)
- Experiment spans from 2025-08-20 now shift to 2025-11-01 (6 days before latest)
- All time distances preserved: if span was 6 days before latest trace, it stays 6 days
- Refactored to eliminate 60+ lines of code duplication across three functions
- Added comprehensive test suite to verify time distance preservation
- All tests passing
- Revision 2: Address Copilot review feedback
- Remove unused 'spans' parameter from process_traces_with_time_shift()
- Fix documentation: clarify that time shift is calculated from traces only
- Make test assertion more flexible: remove date-specific bounds (>60 days)
- All tests passing (6/6)
下载附件