Skip to content

Return seats in use for free or trial subscriptions

What does this MR do?

Context

This is the summary posted on the issue which describes the problem perfectly:

We do not show Seats currently in use for top-level namespaces which are on the Free plan. This makes quoting difficult for sales and forces the prospect to go through many steps to identify how many total users they would be charged for if they purchased a plan.

We should always display Seats currently in use on the Billing page regardless of the tier.

Changes

The change is basically calculating the currently number of used seats at the fly. GitlabSubscription#seats_in_use is invoked through an API call when rendering the subscription table by the frontend. I opted by this strategy instead of making the changes on the cronjob that runs daily by the following reasons:

  1. It will generate less stress to the DB because doing it in the worker means processing thousands (or millions?) of Groups.
  2. I'm confident that the billing page of a Group is not frequently visited.
  3. Calculating the used seats in the worker means that the data will be stale when the free users visit the billing section.

Database impact

As part of this MR, the following 4 queries will now be executed when the billing section for a free or trial Group is visited: https://gitlab.com/gitlab-org/gitlab/-/snippets/2031323

In order to grab the Group with most members, the following query was used: https://gitlab.slack.com/archives/C3NBYFJ6N/p1603145594224200

Screenshots

Before

before

After

after

Tooltips

Free

free

Trial

Before:

trial-before

After:

  • Copy about the seats usage data was removed
  • tooltip copy was updated

trial

Paid

paid

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #260378 (closed)

Edited by Rubén Dávila

Merge request reports