Skip to content

Exclude namespace-banned users from being counted as billable members

What does this MR do and why?

Screenshots or screen recordings

Screen_Recording_2023-03-12_at_9.03.16_pm

How to set up and validate locally

  1. Add any user as a member to a parent group, eg. Gitlab Org on http://localhost:3000/groups/gitlab-org/-/group_members
  2. Calculate the number of billed users for that namespace. The user you just added should be included in that response
bundle exec rails c

> billed_users = Namespace.find_by(name: 'Gitlab Org').billed_user_ids[:user_ids].count
> billed_users[:user_ids].count
> reload!
  1. Ban the user from that namespace.
  1. The user would have now moved to the Banned section on the members page, http://localhost:3000/groups/gitlab-org/-/group_members?tab=banned
  2. Calculate the billed members of that namespace again. The user you just banned should be excluded from that result.

Query Plans with gitlab-org namespace

Method Buffers (current) Buffers (with this query)
billed_group_users 32357 32363
billed_project_users 19083 24460
billed_shared_group_users 32484 33176
billed_invited_group_to_project_users 47875 49338

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Hinam Mehra

Merge request reports

Loading