Skip to content

[REFACTOR] Deprecate sync.GetMetadata and add equivalent field to sync.SyncFlags payload. #1584

Open
4 of 5 issues completed

Description

@toddbaert

Requirements

Currently, to support static context enrichment via attributes sent from flagd, in-process providers call sync.GetMetadata along with starting the stream. This is not ideal. The stream isn't valid without the metadata response (since it could result in rules not functioning as expected due to missing attributes) and the metadata response is useless without the stream.

We should simply move the metadata into the stream response as an optional property. This should be done in a non-breaking way.

Requirements:

  • update proto
  • update flagd
    • serve the current contents of the GetMetadata payload in this new property in the sync stream
    • add a warning log when the old GetMetadata handler is called saying it's deprecated
    • both done with feat: add sync_context to SyncFlags #1642
  • update providers to use the new metadata field, but also use the old RPC for now (new field should "win")

cc @cupofcat @aepfli @chrfwow @beeme1mr @alexandraoberaigner

Sub-issues

Sub-issues

4 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added
    enhancement
    Needs Triage
    and removed
    Needs Triage
    on Mar 6, 2025
  2. toddbaert commented on Mar 7, 2025

    @toddbaert
    MemberAuthor

    @aepfli You also mentioned something about having another field in the SyncFlags RPC... I think it was to make some of the stream logic more isomorphic between the EventStream (RPC mode) and SyncStream (in-process mode), a type field I think... Can you describe that here? We might want to tackle both at the same time. Also, let's try to imagine how it can be done in a non-breaking way so that old providers are compatible with new implementations and vice-versa.

  3. aepfli commented on Mar 7, 2025

    @aepfli
    Member

    of course i can elaborate. Currently within the RPC mode we do have the EventStream, which will send on the inital connection a message provider_ready, and for upcoming messages configuration_change. This allows us within the RPC mode to be stateless. As flagd anyways knows when a configuration is established, or when it only informs about updates.

    see https://buf.build/open-feature/flagd/docs/main:flagd.evaluation.v1#flagd.evaluation.v1.EventStreamResponse

    this would allow us to unify the logic, and keep both modes stateless. Currently we need to know, if we have been connected or not as we need to know, if we need to fire a configuration change or provider ready event.

    I hope i could shed some light here, and i hope my motivation regarding this unification is clear

  4. toddbaert commented on Mar 7, 2025

    @toddbaert
    MemberAuthor

    of course i can elaborate. Currently within the RPC mode we do have the EventStream, which will send on the inital connection a message provider_ready, and for upcoming messages configuration_change. This allows us within the RPC mode to be stateless. As flagd anyways knows when a configuration is established, or when it only informs about updates.

    see https://buf.build/open-feature/flagd/docs/main:flagd.evaluation.v1#flagd.evaluation.v1.EventStreamResponse

    this would allow us to unify the logic, and keep both modes stateless. Currently we need to know, if we have been connected or not as we need to know, if we need to fire a configuration change or provider ready event.

    I hope i could shed some light here, and i hope my motivation regarding this unification is clear

    Yep, clear to me. I will add this to the description.

    I'm actually going to make this a separate issue.

  5. changed the title [-][REFACTOR] Deprecate `sync.GetMetadata` and add equivalent field to `sync.SyncFlags` payload.[/-] [+][REFACTOR] Deprecate `sync.GetMetadata` and add equivalent field, and `type` field to `sync.SyncFlags` payload.[/+] on Mar 7, 2025
  6. changed the title [-][REFACTOR] Deprecate `sync.GetMetadata` and add equivalent field, and `type` field to `sync.SyncFlags` payload.[/-] [+][REFACTOR] Deprecate `sync.GetMetadata` and add equivalent field, and also `type` field, to `sync.SyncFlags` payload.[/+] on Mar 7, 2025
  7. changed the title [-][REFACTOR] Deprecate `sync.GetMetadata` and add equivalent field, and also `type` field, to `sync.SyncFlags` payload.[/-] [+][REFACTOR] Deprecate `sync.GetMetadata` and add equivalent field to `sync.SyncFlags` payload.[/+] on Mar 8, 2025
  8. added this to flagdand flagd and removed this from flagdon Jul 10, 2025
  9. moved this to Todo in flagdon Jul 10, 2025
  10. aepfli commented on Jul 14, 2025

    @aepfli
    Member

    I was thinking about this. Testing this is currently a little bit hard. Because the information will most likely be sent on both channels, via the dedicated endpoint and via the sync payload, do we have a feature flag (pun intended) to switch between the two of them, e.g., a temporary config flag? This would allow us to test this behaviour with our test harness.

    Maybe it is worth adding such a config flag, wdyt?

  11. aepfli commented on Jul 29, 2025

    @aepfli
    Member

    i think we should also implement this in go-sdk-contrib, or am i missing here something

  12. moved this from Todo to In Progress in flagdon Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    • Status
      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions