-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Feature/trace span batch annotation #2850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/trace span batch annotation #2850
Conversation
fa07432 to
568a530
Compare
|
@vladimirrotariu thanks for your contribution, please include a video as per the requirements, also the screenshot provided is not matching expectations. see #1010 - once we are aligned we can review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements batch feedback scoring (annotation) functionality for traces and spans, enabling users to apply scores to multiple items simultaneously. The changes include both frontend UI components and backend API integration for bulk operations.
Key changes:
- Added batch annotation and commenting dialogs with form validation and error handling
- Integrated new batch feedback scores mutation with optimistic cache updates
- Extended the traces/spans action panel with new batch operation buttons
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| TracesActionsPanel.tsx | Added "Annotate" and "Comment" buttons with corresponding dialog components |
| BatchCommentDialog.tsx | New dialog component for adding comments to multiple traces/spans with validation |
| BatchAnnotateDialog.tsx | New dialog component for batch feedback score annotation with form inputs |
| useTracesBatchFeedbackScoresMutation.ts | React Query mutation hook for batch feedback scores with cache management |
| api.ts | Added new batch feedback scores endpoint constant |
apps/opik-frontend/src/components/pages-shared/traces/BatchCommentDialog/BatchCommentDialog.tsx
Show resolved
Hide resolved
...opik-frontend/src/components/pages-shared/traces/BatchAnnotateDialog/BatchAnnotateDialog.tsx
Show resolved
Hide resolved
apps/opik-frontend/src/components/pages/TracesPage/TracesSpansTab/TracesActionsPanel.tsx
Show resolved
Hide resolved
apps/opik-frontend/src/api/traces/useTracesBatchFeedbackScoresMutation.ts
Show resolved
Hide resolved
Screencast.from.08-08-25.07.32.52.webm |
|
@vincentkoc done with the video, thanks. |
|
@andrescrz I implemented the changes as per your code review, thanks! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vladimirrotariu the implementation on the backend side LGTM.
I left some comments, but nothing is really a blocker.
I'll ping our engineers to take a look at the FE changes, if everything looks good, we'll approve and move forward.
This is very close to be ready, thanks a lot!
apps/opik-backend/src/main/java/com/comet/opik/domain/CommentService.java
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/CommentService.java
Show resolved
Hide resolved
...k-backend/src/test/java/com/comet/opik/api/resources/utils/resources/SpanResourceClient.java
Show resolved
Hide resolved
apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java
Show resolved
Hide resolved
apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java
Show resolved
Hide resolved
apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/TracesResourceTest.java
Show resolved
Hide resolved
| @@ -0,0 +1,59 @@ | |||
| import { useMutation, useQueryClient } from "@tanstack/react-query"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that batch endpoints were added on the backend side to support adding comments for both spans and traces, but I don’t see this logic reflected on the frontend. Could you please take a look?
| You can annotate up to {MAX_ENTITIES} traces at a time. Please reduce your selection. | ||
| </div> | ||
| )} | ||
| <div className="grid gap-4 py-4"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to reuse existing UI for this functionality here is the component - FeedbackScoresEditor
| setOpen(5); | ||
| resetKeyRef.current = resetKeyRef.current + 1; | ||
| }} | ||
| disabled={disabled || type !== TRACE_DATA_TYPE.traces} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any specific reason not to add this functionality to Spans? We usually duplicate functionality for both Traces and Spans. You can check our existing implementation of other features for reference.
|
@vladimirrotariu let me know if you will continue to work on this otherwise will close the PR. |
|
@vincentkoc yes, gonna be back to it this weekend! |

Details
Implements “Batch Feedback Score” flow for traces and spans.
Backend
• Service + DAO bulk-save logic
•
/v1/private/traces/feedback-scoresand/v1/private/spans/feedback-scoresendpoints (existing paths now wired for batch)Frontend
• React-Query mutation hook
useBatchFeedbackScores• Optimistic cache update and success/error toasts
• Bulk-select action in Traces/Spans table with modal for score entry
Issues
Resolves #1010
/claim #1010
Testing
• the other components were not tested, here we followed the same.
Documentation
No OpenAPI schema changes required; existing endpoints reused.