Draft: Merge branch...
What does this MR do and why?
This MR introduces a new GitLab GraphQL endpoint that retrieves GitLab Credits usage and overage-terms eligibility for a namespace by delegating the request to CustomersDot. The new endpoint added in this MR is:
query($namespacePath: ID!) {
subscriptionUsage(namespacePath: $namespacePath) {
enabled
overageTermsAccepted
canAcceptOverageTerms
dapPromoEnabled
usageDashboardUrl
}
}
Given a namespacePath, GitLab resolves the associated subscription (if any), then calls out to CustomersDot to fetch usage and eligibility information.
Connection to CustomersDot
This endpoint depends on the CustomersDot MR: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/14143 That MR implements the backing CustomersDot GraphQL query:
query GitlabCreditsUsage {
subscription(subscriptionName: "A-S00012345") {
gitlabCreditsUsage {
overageTermsAccepted
dapPromoEnabled
hasMonthlyCreditCommitment
canAcceptOverageTerms
usageDashboardPath
}
}
}
The GitLab resolver introduced in this MR calls this CustomersDot endpoint internally and maps the returned data into the subscriptionUsage response shape.
References
Screenshots or screen recordings
How to test
Prerequisites
- Ensure the
usage_billing_devfeature flag is enabled:Feature.enable(:usage_billing_dev) - You must have a group/namespace with an active subscription attached to it.
Steps to test
- Open the GitLab GraphQL Playground
- Navigate to: http://gdk.test:3000/-/graphql-explorer (or the equivalent URL for your environment)
- Paste the query from the screenshot (included in this MR). It looks like:
query($namespacePath: ID!) {
subscriptionUsage(namespacePath: $namespacePath) {
enabled
overageTermsAccepted
canAcceptOverageTerms
dapPromoEnabled
usageDashboardUrl
}
}
- Provide variables, replacing namespacePath with your group’s full path. For example:
{
"namespacePath": "my-group"
}
- Execute the query.
- Verify the response fields appear correctly:
- enabled
- overageTermsAccepted
- canAcceptOverageTerms
- dapPromoEnabled
- usageDashboardUrl
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
