Simplify AI User Metrics Endpoint - Remove Historical Seat Assignment Lookup

Description

The aiUserMetrics GraphQL endpoint in ee/app/graphql/resolvers/analytics/ai_metrics/user_metrics_resolver.rb currently performs a historical seat assignment lookup to filter which users' metrics are displayed. This adds unnecessary complexity to the code and creates inconsistency with how other AI metrics endpoints operate.

Problem

  1. Unnecessary complexity - The historical seat assignment lookup adds code complexity that could be removed
  2. Inconsistent behavior - The endpoint acts as a snapshot of seat assignments rather than displaying all user metrics consistently
  3. Alignment with billing model - With usage-based billing, there's no need to filter by historical seat assignments

Proposed Solution

Remove the historical seat assignment lookup from the aiUserMetrics endpoint. This will:

  1. Simplify the code by removing the extra filtering logic
  2. Make the endpoint more consistent with other AI metrics endpoints
  3. Display metrics for all users without seat assignment filtering
  4. Allow for potential optimization of the sorting logic (see related discussion in MR !213812)

Implementation Details

  • Remove historical seat assignment checks from the resolver
  • Ensure the endpoint returns metrics for all users without filtering by seat status
  • Update tests to reflect the new behavior
  • Consider consolidating the service call and lazy-loading users for better performance
Edited by Felipe Cardozo