Skip to content
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

feat: gRPC stream connection deadline #999

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

guidobrei
Copy link
Member

@guidobrei guidobrei commented Oct 3, 2024

This PR

adds deadlines to GRPC stream connections in the flagd provider.

In GRPC setups, where L7 proxies route traffic between the provider and flagd, broken connections in the line can cause a provider never to get updates of chaged flag configurations. The provider never recognizes broken e2e connections because it only listens on the RPC stream and never sends data.
This feature forces a client to open a new GRPC stream after the deadline is exceeded.

Notes

Default stream deadline is 10 Minutes. Deadlines can be disabled by setting it to 0.

Signed-off-by: Guido Breitenhuber <guido.breitenhuber@dynatrace.com>
@@ -55,6 +56,7 @@ public GrpcStreamConnector(final FlagdOptions options) {
serviceStub = FlagSyncServiceGrpc.newStub(channel);
serviceBlockingStub = FlagSyncServiceGrpc.newBlockingStub(channel);
deadline = options.getDeadline();
streamDeadlineMs = options.getStreamDeadlineMs();
Copy link
Member

Choose a reason for hiding this comment

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

[suggestion] Cant we just use the options within this class, and pass it further down the call chain? - adding a new field and parameters might be tedious over time

@@ -64,6 +65,7 @@ public GrpcConnector(final FlagdOptions options, final Cache cache, final Suppli
this.startEventStreamRetryBackoff = options.getRetryBackoffMs();
this.eventStreamRetryBackoff = options.getRetryBackoffMs();
this.deadline = options.getDeadline();
this.streamDeadlineMs = options.getStreamDeadlineMs();
Copy link
Member

Choose a reason for hiding this comment

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

[suggestion] using the options object instead of separate fields would reduce this over head of adding a new field all the time

Copy link
Member

Choose a reason for hiding this comment

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

I can go either way on this one. In fact it might be a good thing to do in a pure refactor/cleanup PR. There's also some naming that we can probably improve with the provider.

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert changed the title feat(flagd): Add GRPC stream connection deadline feat: Add GRPC stream connection deadline Oct 4, 2024
…s/flagd/FlagdOptions.java

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert self-requested a review October 4, 2024 13:29
@toddbaert toddbaert changed the title feat: Add GRPC stream connection deadline feat: gRPC stream connection deadline Oct 4, 2024
@toddbaert toddbaert merged commit 9de03df into open-feature:main Oct 4, 2024
5 checks passed
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.

6 participants