diff --git a/CHANGES.txt b/CHANGES.txt index a94da51..1408609 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,8 @@ -1.2.0 (August XX, 2025) +1.2.0 (September 3, 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..36f6021 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 @@ -24,7 +24,7 @@ import dev.openfeature.sdk.OpenFeatureAPI; import io.split.openfeature.SplitProvider; OpenFeatureAPI api = OpenFeatureAPI.getInstance(); -api.setProvider(new SplitProvider("YOUR_API_KEY")); +api.setProviderAndWait(new SplitProvider("YOUR_API_KEY")); ``` If you are more familiar with Split or want access to other initialization options, you can provide a `SplitClient` to the constructor. See the [Split Java SDK Documentation](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK) for more information. @@ -42,7 +42,7 @@ SplitClientConfig config = SplitClientConfig.builder() .setBlockUntilReadyTimeout(10000) .build(); SplitClient splitClient = SplitFactoryBuilder.build("YOUR_API_KEY", config).client(); -api.setProvider(new SplitProvider(splitClient)); +api.setProviderAndWait(new SplitProvider(splitClient)); ``` ## Use of OpenFeature with Split @@ -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. diff --git a/pom.xml b/pom.xml index b766653..9ab1b77 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ UTF-8 11 - 5.10.2 + 5.13.4 3.2.5 @@ -47,22 +47,17 @@ io.split.client java-client - 4.16.1 + 4.17.0 org.apache.httpcomponents httpclient 4.5.14 - - io.split.integrations.azure - impressions-listener - 0.9.1 - org.mockito mockito-core - 3.4.6 + 5.19.0 test @@ -70,6 +65,16 @@ sdk 1.17.0 + + com.fasterxml.jackson.core + jackson-core + 2.20.0 + + + com.fasterxml.jackson.core + jackson-databind + 2.20.0 + @@ -78,41 +83,41 @@ maven-clean-plugin - 3.1.0 + 3.5.0 maven-resources-plugin - 3.0.2 + 3.3.1 maven-compiler-plugin - 3.8.0 + 3.14.0 maven-surefire-plugin - 2.22.1 + 3.5.3 maven-jar-plugin - 3.0.2 + 3.4.2 maven-install-plugin - 2.5.2 + 3.1.4 maven-deploy-plugin - 2.8.2 + 3.1.4 maven-site-plugin - 3.7.1 + 3.21.0 maven-project-info-reports-plugin - 3.0.0 + 3.9.0 @@ -120,7 +125,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.14.0 11 11 @@ -143,15 +148,6 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - true - - org.apache.maven.plugins maven-source-plugin @@ -168,7 +164,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.2.8 sign-artifacts @@ -179,6 +175,17 @@ + + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 + true + + central + false + published + +