Skip to content

Migrate aiUserMetrics endpoint to namespace_path filtering

Summary

Migrate the aiUserMetrics GraphQL endpoint from legacy contributors-based filtering to namespace_path filtering.

Background

Part of epic #19427 (closed) to standardize AI usage data filtering. The aiUserMetrics endpoint currently uses contributors-based filtering which needs to be migrated to namespace_path filtering for consistency and performance.

Implementation

File: ee/app/services/analytics/ai_analytics/ai_user_metrics_service.rb

  • Remove filter_by_namespace_path_enabled? method
  • Use namespace.traversal_path by default in all queries
  • Remove feature flag conditional logic
  • Simplify placeholders to always use namespace_path filtering

Affected Fields

  • codeSuggestionsAcceptedCount
  • duoChatInteractionsCount

Acceptance Criteria

  • aiUserMetrics uses namespace_path filtering by default
  • Feature flag logic removed
  • Events correctly attributed to namespace hierarchy
  • All tests pass

Related Issues