Skip to content

fix: cleanup some abstractions for circuit breakers #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025

Conversation

aaron-steinfeld
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Apr 8, 2025

Test Results

90 tests  ±0   90 ✅ ±0   26s ⏱️ +2s
16 suites ±0    0 💤 ±0 
16 files   ±0    0 ❌ ±0 

Results for commit df1d491. ± Comparison against base commit db91474.

Copy link

codecov bot commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 60.77%. Comparing base (db91474) to head (df1d491).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...er/grpcutils/CircuitBreakerInterceptorFactory.java 0.00% 2 Missing ⚠️
...ience/ResilienceCircuitBreakerConfigConverter.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #71      +/-   ##
============================================
- Coverage     60.93%   60.77%   -0.17%     
  Complexity      193      193              
============================================
  Files            35       36       +1     
  Lines           750      752       +2     
  Branches         45       45              
============================================
  Hits            457      457              
- Misses          263      265       +2     
  Partials         30       30              
Flag Coverage Δ
unit 60.77% <0.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@aaron-steinfeld aaron-steinfeld marked this pull request as ready for review April 8, 2025 14:31
@aaron-steinfeld aaron-steinfeld requested a review from a team as a code owner April 8, 2025 14:31
@@ -18,7 +18,7 @@ public static Map<String, CircuitBreakerConfig> getCircuitBreakerConfigs(
public static List<String> getDisabledKeys(
Map<String, CircuitBreakerThresholds> configurationMap) {
return configurationMap.entrySet().stream()
.filter(entry -> entry.getValue().isEnabled())
.filter(entry -> !entry.getValue().isEnabled())
Copy link
Contributor

Choose a reason for hiding this comment

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

oh wow. nice find

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

The only approvable part of that PR 🤷‍♂️

public class CircuitBreakerInterceptorFactory {
private final Clock clock;

CircuitBreakerInterceptor buildInterceptor(CircuitBreakerConfiguration<?> configuration) {
Copy link
Contributor

@pavan-traceable pavan-traceable Apr 8, 2025

Choose a reason for hiding this comment

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

It should be static method right ? Should client create a object for this now ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a static here doesn't really provide benefits. For those using DI, they can inject the factory as long as clock is provided in the injector. For those without, it just becomes

new CircuitBreakerInterceptorFactory(clock).buildInterceptor(config);

instead of

CircuitBreakerInterceptorFactory.buildInterceptor(clock, config);

@aaron-steinfeld aaron-steinfeld merged commit 048ff72 into main Apr 8, 2025
5 of 7 checks passed
@aaron-steinfeld aaron-steinfeld deleted the circuit-breaker-cleanup branch April 8, 2025 15:14
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