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::TrialEligibleFinder and GitlabSubscriptions::TrialDurationService call 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_trials and namespace_trial_types in the subscription portal client accept timeout: and max_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

How to set up and validate locally

  1. In a Rails console, enable the flag:
    Feature.enable(:fail_fast_cdot_trial_requests)
  2. Point CUSTOMER_PORTAL_URL at an unreachable or slow host and restart GDK.
  3. 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.log for Unable 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.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading