VSD - Implement the rest of the metrics

Add the following metrics to the previously implemented counter worker.

  • merge_requests
    • iterate: Namespace.where('traversal_ids[1] = ?', group.id).where(type: 'Project')
    • count: merge_requests
    • column: iid
  • projects
    • iterate: Namespace.where('traversal_ids[1] = ?', group.id).where(type: 'Project')
    • count: namespaces
    • column: id
  • groups
    • iterate: Namespace.where('traversal_ids[1] = ?', group.id).where(type: 'Group')
    • count: namespaces
    • column: id
  • pipelines
    • iterate: Namespace.where('traversal_ids[1] = ?', group.id).where(type: 'Project')
    • count: ci_pipelines
    • column: iid
  • members
    • iterate: Namespace.where('traversal_ids[1] = ?', group.id).where(type: 'Group')
    • count: members
    • column: user_id (use distinct_each_batch for counting, see: #394705 (comment 1322288009))

It seems like we can have two strategies:

  • uses each_batch_count
  • uses distinct_each_batch (only for the members count)
Edited by Adam Hegyi