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

Batch evaluation #61

Closed
andreyvital opened this issue May 11, 2019 · 9 comments · Fixed by #296
Closed

Batch evaluation #61

andreyvital opened this issue May 11, 2019 · 9 comments · Fixed by #296
Labels

Comments

@andreyvital
Copy link

Maybe not a top priority right now...but do you think there's a way to batch-evaluate a set of flags?

I plan to use the REST API instead of grpc—so like, it'd be nice if I could send a single request with a set of flags to be evaluated instead of 1 request per flag. Just to avoid all the roundtrips.

Thoughts?

@markphelps
Copy link
Collaborator

Great idea. How would you expect the request body to look?

Something like this, where you evaluate multiple flags but with the same entity_id and context?:

{
"request_id": "string",
"flag_keys": ["string", "string"],
"entity_id": "string",
"context": {
  "property1": "string",
  "property2": "string"
  }
}

Or, would you want to have different context/entity_ids for each flag, something like this:

{
"request_id": "string",
"evaluations": [
  {
    "flag_key": "string",
    "entity_id": "string",
    "context": {
    "property1": "string",
    "property2": "string"
    }
  },
  {
    "flag_key": "string",
    "entity_id": "string",
    "context": {
    "property1": "string",
    "property2": "string"
    }
  },
  ]
}

@andreyvital
Copy link
Author

andreyvital commented May 11, 2019

Hmm...good question, the way I see it is that in the 1st case, who's consuming the API would have to guarantee that the context is appropriate to validate against all constraints in all the flags requested.

Case N2 we'd repeat the context which might increase the request payload... what about allowing both scenarios? one network-friendly and another more "flexible"?

{
  "requestId": "1234",
  "entityId": "127.0.0.1",
  "globalContext": {
    "country": "UK",
    "property": "value"
  },
  "evaluations": [{
    "flagKey": "foo",
  }, {
    "flagKey": "bar",
    "context": {
      "country": "US"
    }
  }]
}

So the developer would consider globalContext for common things across all the flags whereas individual flags' context would be merged with globalContext, but notice, the override priority would come from the individual flag. So:

evaluate "foo" with { country: UK, property: value }
evaluate "bar" with { country: US, property: value }

@markphelps markphelps added this to the 1.0.0 milestone May 11, 2019
@stale
Copy link

stale bot commented Jul 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 11, 2019
@stale stale bot closed this as completed Jul 18, 2019
@markphelps markphelps reopened this Jul 18, 2019
@stale stale bot removed the stale label Jul 18, 2019
@stale
Copy link

stale bot commented Sep 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 16, 2019
@stale stale bot closed this as completed Sep 23, 2019
@sagikazarmark
Copy link
Contributor

Is this actually done or just got closed due to inactivity?

I would also be interested in an evaluateAll request, since a batch can grow pretty large. That would help integrate flipt into existing solutions.

@markphelps
Copy link
Collaborator

@sagikazarmark yeah it was closed due to inactivity. I'll reopen it if its a feature you'd like to see added.

Question about evaluateAll, in what order would it evaluate all the flags? By createdAt? Or would this be configurable per request

@markphelps markphelps reopened this Feb 15, 2020
@stale stale bot removed the stale label Feb 15, 2020
@sagikazarmark
Copy link
Contributor

Hm, I'm not really interested in the order, I just need a list of the flags evaluated for a certain user.

@markphelps
Copy link
Collaborator

Good point, I guess the order wouldnt matter if the response returned match=true/false for each flag, not just the first one that matches.

@andreyvital
Copy link
Author

@markphelps actually that's what needs to happen. It's just to avoid multiple HTTP roundtrips for each flag you know?

@markphelps markphelps removed this from the Pre 1.0.0 milestone Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants