Add openfeature module: OpenFeature Java SDK 1.23.0 and flagd 0.19.0 on Spring Boot 4.2.0, targeting, 10% rollout, live reload, flagd-down behaviour, InMemoryProvider tests, with real transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
658bc52e2b
commit
24dc4ba3ff
@@ -0,0 +1,56 @@
|
||||
# 1. Three callers, one flag file
|
||||
$ curl -H 'X-User-Id: anon-1' localhost:8080/checkout # anonymous
|
||||
page: legacy-checkout
|
||||
newCheckout: {"value": false, "variant": "off", "reason": "DEFAULT"}
|
||||
paymentFlowV2: {"value": false, "variant": "off", "reason": "TARGETING_MATCH"}
|
||||
discountPercent: {"value": 0, "variant": "none", "reason": "DEFAULT"}
|
||||
banner: {"value": "Free shipping over 999", "variant": "plain", "reason": "CACHED"}
|
||||
|
||||
$ curl -H 'X-User-Id: u2' -H 'X-Tier: standard' localhost:8080/checkout # standard
|
||||
page: legacy-checkout
|
||||
newCheckout: {"value": false, "variant": "off", "reason": "DEFAULT"}
|
||||
paymentFlowV2: {"value": false, "variant": "off", "reason": "TARGETING_MATCH"}
|
||||
discountPercent: {"value": 5, "variant": "small", "reason": "TARGETING_MATCH"}
|
||||
banner: {"value": "Free shipping over 999", "variant": "plain", "reason": "CACHED"}
|
||||
|
||||
$ curl -H 'X-User-Id: u3' -H 'X-Tier: premium' localhost:8080/checkout # premium
|
||||
page: new-checkout
|
||||
newCheckout: {"value": true, "variant": "on", "reason": "TARGETING_MATCH"}
|
||||
paymentFlowV2: {"value": false, "variant": "off", "reason": "TARGETING_MATCH"}
|
||||
discountPercent: {"value": 20, "variant": "big", "reason": "TARGETING_MATCH"}
|
||||
banner: {"value": "Free shipping over 999", "variant": "plain", "reason": "CACHED"}
|
||||
|
||||
$ curl -H 'X-User-Id: u4' -H 'X-Tier: standard' -H 'X-Email: [email protected]' localhost:8080/checkout # staff
|
||||
page: new-checkout
|
||||
newCheckout: {"value": true, "variant": "on", "reason": "TARGETING_MATCH"}
|
||||
paymentFlowV2: {"value": false, "variant": "off", "reason": "TARGETING_MATCH"}
|
||||
discountPercent: {"value": 5, "variant": "small", "reason": "TARGETING_MATCH"}
|
||||
banner: {"value": "Free shipping over 999", "variant": "plain", "reason": "CACHED"}
|
||||
|
||||
# 2. Edit the flag file: new-checkout defaultVariant off -> on (no restart, no deploy)
|
||||
$ curl -H 'X-User-Id: anon-1' localhost:8080/checkout # anonymous, after the edit
|
||||
page: new-checkout
|
||||
newCheckout: {"value": true, "variant": "on", "reason": "DEFAULT"}
|
||||
paymentFlowV2: {"value": false, "variant": "off", "reason": "TARGETING_MATCH"}
|
||||
discountPercent: {"value": 0, "variant": "none", "reason": "DEFAULT"}
|
||||
banner: {"value": "Free shipping over 999", "variant": "plain", "reason": "CACHED"}
|
||||
|
||||
# 3. Kill flagd
|
||||
$ curl -H 'X-User-Id: u3' -H 'X-Tier: premium' localhost:8080/checkout # premium, flagd gone
|
||||
page: legacy-checkout
|
||||
newCheckout: {"value": false, "variant": null, "reason": "ERROR", "errorCode": "GENERAL"}
|
||||
paymentFlowV2: {"value": false, "variant": null, "reason": "ERROR", "errorCode": "GENERAL"}
|
||||
discountPercent: {"value": 0, "variant": null, "reason": "ERROR", "errorCode": "GENERAL"}
|
||||
banner: {"value": "Free shipping over 999", "variant": "plain", "reason": "CACHED"}
|
||||
|
||||
|
||||
# Application log: provider events, then the first hook lines
|
||||
INFO com.ankurm.openfeature.FlagConfig : flag provider READY (flagd)
|
||||
INFO com.ankurm.openfeature.FlagConfig : flag provider READY (flagd)
|
||||
INFO com.ankurm.openfeature.FlagConfig : flag configuration changed: [new-checkout]
|
||||
WARN com.ankurm.openfeature.FlagConfig : flag provider STALE: there has been an error
|
||||
...
|
||||
INFO flags : flag=new-checkout value=false variant=off reason=DEFAULT
|
||||
INFO flags : flag=new-checkout value=false variant=off reason=DEFAULT
|
||||
INFO flags : flag=payment-flow-v2 value=false variant=off reason=DEFAULT
|
||||
INFO flags : flag=discount-percent value=0 variant=none reason=DEFAULT
|
||||
Reference in New Issue
Block a user