Skip to content

Conversation

@vladimirrotariu
Copy link
Contributor

Details

Implements “Batch Feedback Score” flow for traces and spans.

Backend
• Service + DAO bulk-save logic
/v1/private/traces/feedback-scores and /v1/private/spans/feedback-scores endpoints (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.

@vladimirrotariu vladimirrotariu force-pushed the feature/trace-span-batch-annotation branch from fa07432 to 568a530 Compare July 30, 2025 03:46
@vladimirrotariu
Copy link
Contributor Author

Screenshot from 2025-07-29 21-43-16

@vincentkoc vincentkoc requested a review from Copilot August 7, 2025 10:42
@vincentkoc
Copy link
Member

@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.

Copy link
Contributor

Copilot AI left a 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

@vladimirrotariu
Copy link
Contributor Author

Screencast.from.08-08-25.07.32.52.webm

@vladimirrotariu
Copy link
Contributor Author

@vincentkoc done with the video, thanks.

@vladimirrotariu
Copy link
Contributor Author

@andrescrz I implemented the changes as per your code review, thanks! :)

cursor[bot]

This comment was marked as outdated.

Copy link
Member

@andrescrz andrescrz left a 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!

@@ -0,0 +1,59 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
Copy link
Contributor

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">
Copy link
Contributor

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}
Copy link
Contributor

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.

@vincentkoc
Copy link
Member

@vladimirrotariu let me know if you will continue to work on this otherwise will close the PR.

@vladimirrotariu
Copy link
Contributor Author

@vincentkoc yes, gonna be back to it this weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]: UI - Ability to Annotate multiple traces at once within a Project

7 participants