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: expose sync-metadata, call RPC with (re)connect #967

Merged
merged 12 commits into from
Sep 30, 2024

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 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 and others added 12 commits September 30, 2024 10:12
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
…s/flagd/resolver/grpc/GrpcConnector.java

Co-authored-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
…s/flagd/FlagdProvider.java

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
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.