diff --git a/CHANGES.txt b/CHANGES.txt index a94da51..111501d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,8 @@ -1.2.0 (August XX, 2025) +1.2.0 (September 2, 2025) - Updated `io.split.client` dependency to 4.16.1 - Updated `dev.openfeature` dependency to 1.17.0 + - Added tracking support + - Added “evaluate with details” support 1.1.0 - Up tp date with spec v0.5.0 and java sdk v0.3.1 diff --git a/README.md b/README.md index ed1dd96..0cc3be0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This SDK is compatible with Java 11 and higher. io.split.openfeature split-openfeature-provider - 1.1.0 + 1.2.0 ``` ### Configure it @@ -67,6 +67,52 @@ OpenFeatureAPI.getInstance().setEvaluationContext(context) ```` If the context was set at the client or api level, it is not required to provide it during flag evaluation. +## Evaluate with details + +Use the get*Details(...) APIs to get the value and rich context (variant, reason, error code, metadata). +This provider includes the Split treatment config as a raw JSON string under flagMetadata["config"] +```java +// boolean/string/number/object all have *Details variants: +FlagEvaluationDetails details = + client.getStringDetails("my-flag", "fallback", ctx); + +Metadata md = details.getFlagMetadata(); +if (md != null) { + + Map meta = md.asMap(); + + Value config = meta.get("config"); // ← Split treatment config +} +``` + +## Tracking +To use track(eventName, context, details) you must provide: + +- targetingKey on the EvaluationContext (non-blank). + +- trafficType in the context (string, e.g. "user" or "account"). + +- A non-blank eventName. + +Optional: + +- details.value: numeric event value (defaults to 0). + +- details.properties: map of attributes (prefer primitives: string/number/boolean/null). + +Example: + +```java +MutableContext ctx = new MutableContext("user-123"); +ctx.add("trafficType", new Value("user")); + +TrackingEventDetails details = new MutableTrackingEventDetails(19.99) + .add("plan", new Value("pro")) + .add("coupon", new Value("WELCOME10")); + +client.track("checkout.completed", ctx, details); +``` + ## Submitting issues The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/split-openfeature-provider-java/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.