Create distinct route for api/v4/internal/allowed with circuit breaker
What does this MR do and why?
This applies the circuitbreaker (implementation, MR) to the rails api/v4/internal/allowed endpoint.
Currently, requests to /api/* routes are proxied by this handler. This MR adds a handler specifically for the /api/v4/internal/allowed endpoint that wraps the proxy with a circuit breaker when the circuit breaker is enabled in the config.
References
Related to https://gitlab.com/gitlab-org/gitlab/-/issues/525382
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Enable the circuit breaker feature flag
Feature.enable(:workhorse_circuit_breaker) - Add the following to your
workhorse/config.toml
[circuit_breaker]
enabled = true
timeout = 30
interval = 60
max_requests = 1
consecutive_failures = 5
gdk restart- git clone, push, pull via ssh with no issues
- Comment out this line
- Git clone, push, and pull trip the circuit breaker (
gobreaker: state changein workhorse logs) - Subsequent requests don't reach
/allowed. You can add a breakpoint or a print statement here to ensure the endpoint isn't reached.
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.
Edited by Fred Reinink