Fail fast on CustomersDot trial eligibility calls
What does this MR do and why?
Page renders (the group tier badge, the sidebar upgrade link, the Duo trial panel, free-user-cap alerts) call CustomersDot for trial eligibility and trial types. When CustomersDot is slow, each of those renders waits for the default Gitlab::HTTP timeout, and a failed eligibility lookup is never cached, so the next render calls CustomersDot again.
Behind the fail_fast_cdot_trial_requests flag (gitlab_com_derisk, default off):
Namespaces::TrialEligibleFinderandGitlabSubscriptions::TrialDurationServicecall CustomersDot with a 1 second timeout and no retries.- A failed eligibility lookup is cached as "no eligible trials" for 5 minutes. Successful lookups keep the existing 8 hour cache.
- The trial types cache uses
race_condition_ttl: 1.minute, so only one request refreshes it when it expires. namespace_eligible_trialsandnamespace_trial_typesin the subscription portal client accepttimeout:andmax_retries:. Existing callers are unchanged.
The timeout option applies to the connect and read phases separately, matching the existing self_managed_trial_availability call.
A CustomersDot latency SLI for these calls is planned as a follow-up.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/635544
- Rollout issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/636177
How to set up and validate locally
- In a Rails console, enable the flag:
Feature.enable(:fail_fast_cdot_trial_requests) - Point
CUSTOMER_PORTAL_URLat an unreachable or slow host and restart GDK. - As the owner of a private Free group whose trial has expired, visit the group page. It renders within about a second, and reloading within 5 minutes does not call CustomersDot again (check
log/application_json.logforUnable to fetch eligible trials from GitLab Customers App: one entry, not one per load).
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.