Repository navigation
Add registry decorators for deadlines and service-keyed circuit breakers #94
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
Open
suresh-prakash
wants to merge
9
commits into
main
Choose a base branch
from
grpc-registry-decorators
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,147
−6
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d2bcd3b
Plan registry decorators for deadlines and service circuit breakers.
suresh-prakash e099cfd
Record the worktree Gradle version required for dependency locking.
suresh-prakash 01e657e
Add a channel-registry decorator that installs one client interceptor.
suresh-prakash fef7b20
Apply a configured default deadline to every channel from a registry.
suresh-prakash 8e081c8
Parse the gRPC statuses that count as circuit-breaker failures.
suresh-prakash a5cdb78
Add a service-keyed gRPC circuit breaker interceptor.
suresh-prakash f8a3844
Install the service-keyed circuit breaker from an existing channel re…
suresh-prakash 6c644d1
Address review notes on the registry decorators.
suresh-prakash 68ee8a5
Let registry wrap take service thresholds directly.
suresh-prakash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,6 @@ | |
| build | ||
|
|
||
| .idea | ||
|
|
||
| .superpowers/ | ||
| docs/superpowers/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../src/main/java/org/hypertrace/circuitbreaker/grpcutils/CircuitBreakerChannelRegistry.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package org.hypertrace.circuitbreaker.grpcutils; | ||
|
|
||
| import com.typesafe.config.Config; | ||
| import java.util.Map; | ||
| import lombok.AccessLevel; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry; | ||
| import org.hypertrace.core.grpcutils.client.InterceptingChannelRegistry; | ||
|
|
||
| @Slf4j | ||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
| public final class CircuitBreakerChannelRegistry { | ||
|
|
||
| static final String CIRCUIT_BREAKER_CONFIG = CircuitBreakerConfigParser.CIRCUIT_BREAKER_CONFIG; | ||
|
|
||
| public static GrpcChannelRegistry wrap(final GrpcChannelRegistry registry, final Config config) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not take in the first-class object here instead of typesafe? |
||
| return wrap(registry, CircuitBreakerConfigParser.parseServiceThresholds(config)); | ||
| } | ||
|
|
||
| public static GrpcChannelRegistry wrap( | ||
| final GrpcChannelRegistry registry, | ||
| final Map<String, CircuitBreakerThresholds> thresholdsByService) { | ||
| if (registry == null || thresholdsByService == null || thresholdsByService.isEmpty()) { | ||
| log.debug("No enabled service circuit breakers; leaving the channel registry unchanged"); | ||
| return registry; | ||
| } | ||
| return InterceptingChannelRegistry.wrap( | ||
| registry, CircuitBreakerInterceptorFactory.forService(thresholdsByService)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...c/main/java/org/hypertrace/circuitbreaker/grpcutils/CircuitBreakerInterceptorFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/superpowers can also be ignored.