Skip to content

feat: introduce circuit breakers for oauth - #6411

Merged
atzoum merged 3 commits into
masterfrom
feat.oauthCircuitBreakers
Oct 16, 2025
Merged

atzoum merged 3 commits into
masterfrom
feat.oauthCircuitBreakers

Conversation

@atzoum

@atzoum atzoum commented Oct 2, 2025 •

Copy link
Copy Markdown
Contributor

Description

Adding two circuit breakers in the oauth handler for each account ID to prevent excessive requests to the oauth service:

  • Error breaker: in case of too many errors the circuit will open returning the last error for 5 minutes
  • Success breaker: in case of too many new token refreshes (5 in 1 minute) the circuit will open returning the last token for 1 minute

Configuration options

  • OauthBreaker.consecutiveErrorsThreshold - number of consecutive errors to trip the error breaker (default: 5)
  • OauthBreaker.errorsTimeout: time duration that needs to elapse to switch an open error breaker to half-open state (default: 5m)
  • OauthBreaker.successesThreshold - number of successful (new) token generations within the interval to trip the success breaker (default: 5)
  • OauthBreaker.successesInterval - time duration that needs to elapse to reset the success counter (default: 1m)
  • OauthBreaker.successesTimeout - time duration that needs to elapse to switch an open success breaker to half-open state (default: 1m)

The above configuration options can be overriden at a destination level,
e.g. Router.REDDIT.OauthBreaker.consecutiveErrorsThreshold

Integration tests

Introducing integration tests for oauth handler verifying handler's behaviour against the actual auth services (config-backend & rudder-auth)

Linear Ticket

resolves PIPE-2459

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@codecov

codecov Bot commented Oct 2, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.64286% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.77%. Comparing base (ce4d56d) to head (4e91a5a).

Files with missing lines Patch % Lines
services/oauth/v2/oauth_breaker.go 95.38% 4 Missing and 2 partials ⚠️
...yncdestinationmanager/bing-ads/audience/manager.go 0.00% 1 Missing ⚠️
...ionmanager/bing-ads/offline-conversions/manager.go 0.00% 1 Missing ⚠️
...ter/batchrouter/asyncdestinationmanager/manager.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6411      +/-   ##
==========================================
+ Coverage   77.68%   77.77%   +0.08%     
==========================================
  Files         528      529       +1     
  Lines       70196    70344     +148     
==========================================
+ Hits        54534    54708     +174     
+ Misses      12834    12817      -17     
+ Partials     2828     2819       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from chore.oauthCb to master October 7, 2025 05:14
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch 2 times, most recently from 6bf0271 to 70521b3 Compare October 8, 2025 10:52
@atzoum atzoum changed the title [WIP] feat: oauth circuit breakers feat: introduce oauth circuit breakers Oct 8, 2025
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch 3 times, most recently from 21cbaa8 to bd17c3d Compare October 8, 2025 14:09
@atzoum atzoum changed the title feat: introduce oauth circuit breakers feat: introduce circuit breakers for oauth Oct 8, 2025
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch from bd17c3d to 03f3ba0 Compare October 9, 2025 06:21
@atzoum
atzoum marked this pull request as ready for review October 9, 2025 10:14
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch from 03f3ba0 to aad01bd Compare October 9, 2025 10:15
@krishna2020
krishna2020 requested review from vinayteki95 and removed request for koladilip October 12, 2025 16:45
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch 2 times, most recently from 945c7f6 to 68bff61 Compare October 13, 2025 15:36

@fracasula fracasula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atzoum I left some comments

Comment thread router/transformer/transformer_test.go Resolved
Comment thread router/transformer/transformer_test.go Resolved
Comment thread services/oauth/v2/oauth_breaker.go Resolved
Comment thread services/oauth/v2/oauth_breaker.go Resolved
Comment thread services/oauth/v2/oauth_breaker.go Resolved
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch 2 times, most recently from 09acb94 to 54ea27f Compare October 14, 2025 06:19
@atzoum
atzoum requested a review from fracasula October 14, 2025 07:37
Comment thread services/oauth/v2/oauth_breaker.go Resolved
@atzoum
atzoum requested a review from ktgowtham October 15, 2025 15:21
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch from 54ea27f to d0eacb7 Compare October 16, 2025 06:11
@atzoum
atzoum force-pushed the feat.oauthCircuitBreakers branch from d0eacb7 to 4e91a5a Compare October 16, 2025 06:22
@atzoum
atzoum merged commit b9ed172 into master Oct 16, 2025
@atzoum
atzoum deleted the feat.oauthCircuitBreakers branch October 16, 2025 06:57
This was referenced Oct 27, 2025
mihir20 pushed a commit that referenced this pull request Oct 27, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.62.0-rc.1](v1.61.0...v1.62.0-rc.1)
(2025-10-27)


### Features

* introduce circuit breakers for oauth
([#6411](#6411))
([b9ed172](b9ed172))


### Bug Fixes

* deltalake fetch table attributes
([#6455](#6455))
([49907dc](49907dc))
* destination namespaces api to contain tablename filter
([#6388](#6388))
([61cffa4](61cffa4))
* repo cardinatlity for warehouse queries
([#6451](#6451))
([ac9adc4](ac9adc4))


### Miscellaneous

* always emit transformer_outgoing_request_latency metric
([#6454](#6454))
([33b742c](33b742c))
* avoid scanning all schemas and use limit 1
([#6396](#6396))
([8bb69ee](8bb69ee))
* bump rudder-go-kit to 0.63.4
([#6457](#6457))
([d499351](d499351))
* cleanup Avoid using beigntx within repo package and instead use
WithTx.
([#6389](#6389))
([21b7129](21b7129))
* improve cron tracker
([#6397](#6397))
([82407f4](82407f4))
* improve logging reporting event name trimming
([#6424](#6424))
([ce4d56d](ce4d56d))
* improve pending uploads
([#6399](#6399))
([717f6a6](717f6a6))
* improve populate table level schemas
([#6395](#6395))
([a0aa222](a0aa222))
* improve table level schemas
([#6398](#6398))
([a2d3786](a2d3786))
* remove monitor database
([#6393](#6393))
([a02c218](a02c218))
* remove unused oauthV2Enabled logger
([#6465](#6465))
([bf55861](bf55861))
* retaining both pickup query throttling configuration key options
([#6453](#6453))
([a51f395](a51f395))
* **router:** pickup query throttling should be enabled by default
([#6447](#6447))
([ff18dde](ff18dde))
* security improvements
([#6430](#6430))
([ce4d56d](ce4d56d))
* simplify pickup throttling configuration
([#6460](#6460))
([7fb035b](7fb035b))
* unused dependencies
([#6392](#6392))
([8e585b7](8e585b7))
* use org-wide docker registry mirror configuration
([#6444](#6444))
([f714b32](f714b32))
* using go-kit maxprocs
([#6433](#6433))
([674ab55](674ab55))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
mihir20 pushed a commit that referenced this pull request Oct 28, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.62.0](v1.61.0...v1.62.0)
(2025-10-27)


### Features

* introduce circuit breakers for oauth
([#6411](#6411))
([b9ed172](b9ed172))


### Bug Fixes

* deltalake fetch table attributes
([#6455](#6455))
([49907dc](49907dc))
* destination namespaces api to contain tablename filter
([#6388](#6388))
([61cffa4](61cffa4))
* repo cardinatlity for warehouse queries
([#6451](#6451))
([ac9adc4](ac9adc4))


### Miscellaneous

* always emit transformer_outgoing_request_latency metric
([#6454](#6454))
([33b742c](33b742c))
* avoid scanning all schemas and use limit 1
([#6396](#6396))
([8bb69ee](8bb69ee))
* bump rudder-go-kit to 0.63.4
([#6457](#6457))
([d499351](d499351))
* cleanup Avoid using beigntx within repo package and instead use
WithTx.
([#6389](#6389))
([21b7129](21b7129))
* improve cron tracker
([#6397](#6397))
([82407f4](82407f4))
* improve logging reporting event name trimming
([#6424](#6424))
([ce4d56d](ce4d56d))
* improve pending uploads
([#6399](#6399))
([717f6a6](717f6a6))
* improve populate table level schemas
([#6395](#6395))
([a0aa222](a0aa222))
* improve table level schemas
([#6398](#6398))
([a2d3786](a2d3786))
* remove monitor database
([#6393](#6393))
([a02c218](a02c218))
* remove unused oauthV2Enabled logger
([#6465](#6465))
([bf55861](bf55861))
* retaining both pickup query throttling configuration key options
([#6453](#6453))
([a51f395](a51f395))
* **router:** pickup query throttling should be enabled by default
([#6447](#6447))
([ff18dde](ff18dde))
* security improvements
([#6430](#6430))
([ce4d56d](ce4d56d))
* simplify pickup throttling configuration
([#6460](#6460))
([7fb035b](7fb035b))
* unused dependencies
([#6392](#6392))
([8e585b7](8e585b7))
* use org-wide docker registry mirror configuration
([#6444](#6444))
([f714b32](f714b32))
* using go-kit maxprocs
([#6433](#6433))
([674ab55](674ab55))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants