flagr icon indicating copy to clipboard operation
flagr copied to clipboard

[Feature Request] Add "flag type" and possibly metadata to Flag model

Open rclayton-the-terrible opened this issue 4 years ago • 2 comments

I was curious if there would be interest in this feature request. If so, I would commit to taking it on (however, I'm not a competent Go developer).

Basically, in our system the UI/Services that consume flags don't necessarily know all the flag id's ahead of time, so sending a list of flag keys (or IDs) to the batch evaluation route requires us to pull all flags first to form the eval request. We've optimized this by caching keys/ids, but it would be great if we could some how request a subset of the flags be automatically included in a batch eval. Perhaps this could be done by filtering a key-value list of metadata on each flag?

Also, we manage the life cycle of our flags based on the flag type, following the categorization denoted by the Thoughtworks piece (https://martinfowler.com/articles/feature-toggles.html). It would be great if there was an arbitrary flag type that could be added to the model (perhaps that should also be metadata?). Right now, we have implemented a hierarchical key structure that allows us to infer the type, but the approach is kind of clunky, and prone to error when users manually manipulate flags in the UI.

BTW - Love the framework; thank you for all the hard work.

rclayton-the-terrible avatar Jan 13 '20 21:01 rclayton-the-terrible

Hey @rclayton-the-terrible

I really like the idea, basically tag/group a few flags together, and pass it as one of the parameters to https://checkr.github.io/flagr/api_docs/#operation/postEvaluationBatch

E.g.

{
  "entities": [
    {
      "entityID": "1234",
      "entityType": "foobar",
      "entityContext": {}
    }
  ],
  "flagTags": [
    "tag1",
    "tag2"
  ]
}

And then we index the tag in memory for flags lookup in the cache and convert that to flag IDs. For the CRUD api, add a tag field to flags.

PRs are always welcome! If I have time, I can also work on it later.

zhouzhuojie avatar Jan 14 '20 00:01 zhouzhuojie

@zhouzhuojie didn't think about just using an array of tags, but I really like the idea. That would avoid adding too much complexity and meet all my needs. I will try to implement it myself and post a PR. Thank you!

rclayton-the-terrible avatar Jan 15 '20 02:01 rclayton-the-terrible

Stale issue message

github-actions[bot] avatar Aug 26 '22 21:08 github-actions[bot]