581293 - User AI Metrics Sorting
What does this MR do and why?
Add sorting field to aiUserMetrics endpoint. This mainly contributes to GitLab Duo and SDLC trends dashboard
Sorting logic was handled in previous MR !213952 (merged)
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Optional: Generate AI Usage Metrics:
PROJECT_ID=your_project_id FILTER=ai_usage_stats bundle exec rake db:seed_fu
- GraphQL query for testing in https://gdk.test:3000/-/graphql-explorer :
query getUserAiUserMetrics($fullPath: ID!, $startDate: Date!, $endDate: Date!) {
project(fullPath: $fullPath) {
id
aiUserMetrics(startDate: $startDate, endDate: $endDate, sort: CHAT_TOTAL_COUNT_ASC) {
nodes {
user {
id
name
}
totalEventCount
codeSuggestionsAcceptedCount
codeSuggestions {
codeSuggestionShownInIdeEventCount
codeSuggestionAcceptedInIdeEventCount
codeSuggestionRejectedInIdeEventCount
totalEventCount
}
chat {
requestDuoChatResponseEventCount
totalEventCount
}
codeReview {
totalEventCount
encounterDuoCodeReviewErrorDuringReviewEventCount
findNoIssuesDuoCodeReviewAfterReviewEventCount
findNothingToReviewDuoCodeReviewOnMrEventCount
postCommentDuoCodeReviewOnDiffEventCount
reactThumbsUpOnDuoCodeReviewCommentEventCount
reactThumbsDownOnDuoCodeReviewCommentEventCount
requestReviewDuoCodeReviewOnMrByAuthorEventCount
requestReviewDuoCodeReviewOnMrByNonAuthorEventCount
excludedFilesFromDuoCodeReviewEventCount
}
agentPlatform {
agentPlatformSessionCreatedEventCount
agentPlatformSessionStartedEventCount
agentPlatformSessionFinishedEventCount
agentPlatformSessionDroppedEventCount
agentPlatformSessionStoppedEventCount
agentPlatformSessionResumedEventCount
}
troubleshootJob{
troubleshootJobEventCount
}
}
}
}
}
Sorting with any field should work in both ASC and DESC order
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #581293
Edited by Amr Taha