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

Support of evaluation context enrichment #1285

Merged
merged 10 commits into from
Nov 20, 2023

Conversation

thomaspoignant
Copy link
Owner

@thomaspoignant thomaspoignant commented Nov 20, 2023

Description

The common evaluation context is a new mechanism that enriches all the evaluation contexts with a common context of the execution server.

This is particularly useful when you support different environment variables, or if you want to target a specific server.

To use it, you can configure the field EvaluationContextEnrichment (map[string]interface{}), so you can add everything you want to enrich the request.

⚠️ In case we have the same key in the EvaluationContextEnrichment and in the EvaluationContext, the EvaluationContextEnrichment will override what was set in the EvaluationContext.

Example

If you configure your EvaluationContextEnrichment like this:

"serverName": "server01"
"IP": "8.8.8.8"
"environment": "prod"

And you evaluation your flag with this context:

"name": "John Doe"
"email": "john.doe@gofeatureflag.org"
"key": "123456789"

Your context will be merged and you will be able to create rules about all those fields:

"serverName": "server01"
"IP": "8.8.8.8"
"environment": "prod"
"name": "John Doe"
"email": "john.doe@gofeatureflag.org"
"key": "123456789"

Changes include

  • New feature (non-breaking change that adds functionality)

Closes issue(s)

Resolve #1270

Checklist

  • I have tested this code
  • I have added unit test to cover this code
  • I have updated the documentation (README.md and /website/docs)
  • I have followed the contributing guide

Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
Copy link

netlify bot commented Nov 20, 2023

Deploy Preview for go-feature-flag-doc-preview canceled.

Name Link
🔨 Latest commit ccd52e7
🔍 Latest deploy log https://app.netlify.com/sites/go-feature-flag-doc-preview/deploys/655b420553e980000845ec1e

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (8ffeb58) 88.67% compared to head (ccd52e7) 88.68%.

Files Patch % Lines
cmd/relayproxy/service/gofeatureflag.go 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1285      +/-   ##
==========================================
+ Coverage   88.67%   88.68%   +0.01%     
==========================================
  Files          70       71       +1     
  Lines        3275     3287      +12     
==========================================
+ Hits         2904     2915      +11     
- Misses        301      302       +1     
  Partials       70       70              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thomaspoignant thomaspoignant changed the title Support of common evaluation context Support of common evaluation context enrichment Nov 20, 2023
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
@thomaspoignant thomaspoignant changed the title Support of common evaluation context enrichment Support of evaluation context enrichment Nov 20, 2023
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
…elay proxy

Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
Copy link

@richardj-bsquare richardj-bsquare left a comment

Choose a reason for hiding this comment

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

Looks like the new evaluation context should meet the requirements outlined in #1270

Looking forward to trying it out!

Copy link

sonarcloud bot commented Nov 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@thomaspoignant thomaspoignant merged commit b3874ea into main Nov 20, 2023
21 of 22 checks passed
@thomaspoignant thomaspoignant deleted the support-common-evaluation-context branch November 20, 2023 12:20
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.

(feature) Add ability for proxy to inject context
2 participants