-
[OPIK-3208] [FE] [BE] Adjust Trace Detail View to Show Span Scores (#4203)
发布于
2025-11-28 09:17:48 +00:00 - [OPIK-3208] [BE] Add span feedback scores aggregation to trace detail view
- Add span_feedback_scores field to Trace API model
- Add span score aggregation logic to TraceDAO query
- Update TraceEnrichmentMapper to map aggregated span scores
- Add tests for span score aggregation
- Update testcontainers version to 2.0.2
- Fix getValue method to handle missing columns gracefully
[OPIK-3208] [FE] Display aggregated span feedback scores in trace detail view
- Add span_feedback_scores to Trace type definition
- Display aggregated span feedback scores in TraceDataViewer
- Add span feedback score chips in trace tree view
- Update TreeDetailsStore to support span_feedback_scores
- Remove individual span scores drill-down section
- [OPIK-3208] [FE] Fix feedback scores title for span view
- Show 'Trace Feedback Scores' only when viewing a trace
- Show 'Feedback Scores' when viewing a span
- [OPIK-3208] [FE] Disable deletion for span feedback scores at trace level
- Make onDeleteFeedbackScore optional in FeedbackScoreTable
- Hide delete actions column when deletion is disabled
- Prevent deletion of aggregated span scores shown at trace level
- refactor: Remove code duplication in span feedback scores display
- Extract helper functions for value parsing and display logic in ValueCell
- Consolidate child row creation logic into reusable createChildRow function
- Export extractAuthorName helper and use it consistently in AuthorCell
- Simplify formatParentRowWithCounts by merging categorical/non-categorical logic
- Add spanId field to ValueEntry API model for proper span identification
This refactoring reduces code duplication by ~60 lines and improves maintainability
without changing functionality.- feat: Add Type column cell component for span feedback scores
- Create TypeCell component to display span type with icon and label
- Component hides type for parent/aggregated rows
- Uses BaseTraceDataTypeIcon for consistent iconography
- Part of span feedback scores feature implementation
- feat: Add aggregated span feedback scores display in trace detail view
Backend changes:
- Add span feedback scores aggregation in TraceDAO using CTEs
- Include span_id, span_type, and category_name in value_by_author map
- Use composite keys (author_spanId) to preserve individual span scores
- Filter out '' from aggregated reasons
- Add spanId field to ValueEntry API model
Frontend changes:
- Display aggregated span feedback scores in trace detail view
- Add hierarchical view with parent/child rows for multiple spans
- Add Type column to show span type (LLM, Tool, General, Guardrail)
- Support deletion of individual span scores using span_id
- Update table titles to 'Trace scores' and 'Span scores' (Sentence case)
- Fix author name display to handle composite keys correctly
- Update value formatting to show counts and averages for parent rows
- Remove span feedback scores tags from trace header and tree view
- Update tooltips to include 'span' suffix (e.g., 'LLM span')
- Fix 'All scores' summary to display actual values
- Handle empty reasons gracefully (don't show '')
This feature allows users to see aggregated feedback scores from multiple spans
at the trace level while maintaining the ability to view and manage individual
span scores.- fix: Update annotation sidebar titles and score filtering
- Change sidebar title to 'Trace feedback scores' / 'Span feedback scores'
- Change 'All scores' section to show 'Trace scores' / 'Span scores' (remove 'All scores' prefix)
- Filter scores correctly: only show trace scores when viewing trace, only span scores when viewing span
- Update 'Your scores' header to include entity type (Trace/Span/Thread scores)
- Update Thread annotations to match the same pattern
- [FE] Refactor feedback score tables to use isAggregatedSpanScores prop
- Replace 'span-detail' entityType with isAggregatedSpanScores prop for cleaner logic
- Extract helper functions to reduce code duplication (getStorageKeyType, getConfigurableColumnsWithoutType)
- Fix all linting errors and remove unused imports/variables
- Improve code organization and maintainability
- [FE] Fix Type column truncation and reduce table spacing
- Add proper truncation classes (min-w-0, flex-1) to Type column to prevent text overlapping
- Change mb-4 to mb-2 for title/columns button spacing to reduce gap before table
- [OPIK-3208] Address PR review comments
- Fix duplicated text in ThreadAnnotations (All scores Thread scores -> Thread scores)
- Remove redundant case-insensitive check for '' in feedback-scores.tsx
- Fix extractAuthorName to use lastIndexOf for author names with underscores
- Only show parenthesized value in ValueCell when it differs from display value
- Create shared isValidReason utility function for consistent filtering
- Refactor FeedbackScoresEditor title logic with getTitleOfScores function
- Move span_id extraction from FeedbackScoresEditor to TraceAnnotateViewer
- Optimize AuthorCell with useMemo for author extraction
- Add documentation comment in TraceDAO explaining composite key format
下载附件