open-feature / ofep

A focal point for OpenFeature research, proposals and requests for comments
https://openfeature.dev
20 stars 15 forks source link

[Proposal] [flagD] Flag update subscribers via gRPC streams #18

Closed james-milligan closed 1 year ago

james-milligan commented 2 years ago

Using gRPC streams we can create subscribers to allow for client side updates to be driven from flag value changes in situations where a flag will not be re-evaluated, such as those involved in startup.

Next steps:

  1. What is the process that will be used to subscribe to changes on a flag - will multiple client connections be spun up or will one connection handle all updates?
  2. What will the schema look like for the subscription requests and updates - will these changes be incorporated into the existing interface or will they sit on a separate one?
  3. If we choose to implement this in the rest interface of flagd, how will this be done? (websockets, server push or not at all?)
james-milligan commented 2 years ago

To aid with the simplicity of both the client and server implementations for the subscribers I propose that a single grpc stream is opened for each flag. This will reduce the requirement of routing the received flag values on the client side, the downside of this is an increased number of open connections.

Ive put together 2 diagrams to show a possible mechanism for this approach, happy to do the same for a 'singleton' connection in which all subscribed flag updates are handled over the same grpc stream.

image

In this example the context is sent with the subscription request and will be used in the flag evaluation once an updated flag value is received, a state Is also stored to ensure only deltas are sent - preventing repeated values being received client side.

image

In this example no context is present, this may be required when the context value is likely to change following the subscription to a given flag key. In this example the client receives a notification of change and can then request the new flag value via the standard grpc/rest interfaces.

Its likely that both of these will need to be present and the interface will contain pairs of subscribers, such as SubscribeToBoolean and SubscribeToBooleanNoContext

beeme1mr commented 1 year ago

@james-milligan, is this issue still relevant?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in next 60 days.

james-milligan commented 1 year ago

@james-milligan, is this issue still relevant?

no, will close