Skip to content

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Sep 24, 2024

This PR:

  • adds call to GetMetadata on gRPC connection init with the in-process provider
    • this returns metadata from flagd which can be used to enrich local (in-process) evaluation
    • the metadata is exposed on the provider in the protected getSyncMetadata accessor, and updated when the stream is (re)established, from here it can be used in provider hooks, events, etc
  • associated tests and refactors

Please note the call logic may look a bit strange, but I think it's optimal. We call the getMetadata RPC as soon as we initiate the stream, and ignore exceptions. This is because it's very unlikely that the metadata RPC will fail while the stream succeeds, and every attempt to reconnect the stream will also retry the metadata - so we should be good with this pattern. If for some reason the metadata call fails but we connect without an issue, we log it.

@toddbaert toddbaert requested a review from guidobrei September 25, 2024 18:04
@toddbaert toddbaert force-pushed the feat/sync-metadata branch 2 times, most recently from e61a462 to 3186010 Compare September 25, 2024 18:21
@aepfli
Copy link
Member

aepfli commented Sep 27, 2024

We should also document this feature within the providers readme - i think this is important to be aware of.

@toddbaert toddbaert force-pushed the feat/sync-metadata branch 3 times, most recently from 0891c8a to 100b3e9 Compare September 27, 2024 19:42
@@ -20,10 +22,11 @@
@Slf4j
@SuppressWarnings({ "PMD.TooManyStaticImports", "checkstyle:NoFinalizer" })
public class FlagdProvider extends EventProvider {
private static final String FLAGD_PROVIDER = "flagD Provider";
private static final String FLAGD_PROVIDER = "flagd Provider";
Copy link
Member

Choose a reason for hiding this comment

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

Should we drop the provider suffix?

Copy link
Member Author

Choose a reason for hiding this comment

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

ya, probably. I'll update.

@toddbaert toddbaert merged commit 61bb726 into main Sep 30, 2024
4 checks passed
@toddbaert toddbaert deleted the feat/sync-metadata branch September 30, 2024 14:21
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.