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

ufc readme update #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 92 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,99 @@
# Eppo Server-Side SDK for Java
# Eppo Java SDK

## Getting Started
[![Test and lint SDK](https://github.com/Eppo-exp/java-server-sdk/actions/workflows/lint-test-sdk.yml/badge.svg)](https://github.com/Eppo-exp/java-server-sdk/actions/workflows/lint-test-sdk.yml)

Refer to our [SDK documentation](https://docs.geteppo.com/feature-flags/sdks/server-sdks/java) for how to install and use the SDK.
[Eppo](https://www.geteppo.com/) is a modular flagging and experimentation analysis tool. Eppo's Java SDK is built to make assignments in multi-user server side contexts. Before proceeding you'll need an Eppo account.

## Contributing
## Features

A version of Java 8 is required to locally compile the SDK.
- Feature gates
- Kill switches
- Progressive rollouts
- A/B/n experiments
- Mutually exclusive experiments (Layers)
- Dynamic configuration

## Installation

In your pom.xml, add the SDK package as a dependency:

```
<dependency>
<groupId>cloud.eppo</groupId>
<artifactId>eppo-server-sdk</artifactId>
<version>2.0.0</version>
</dependency>
```

## Quick start

Begin by initializing a singleton instance of Eppo's client. Once initialized, the client can be used to make assignments anywhere in your app.

#### Initialize once

```java
EppoClientConfig config = EppoClientConfig.builder()
.apiKey("SDK-KEY-FROM-DASHBOARD")
.build();

EppoClient eppoClient = EppoClient.init(config);
```


#### Assign anywhere

```java
Optional<String> assignedVariation = eppoClient.getStringAssignment(
'new-user-onboarding',
user.id,
user.attributes,
'control'
);
```

## Assignment functions

Every Eppo flag has a return type that is set once on creation in the dashboard. Once a flag is created, assignments in code should be made using the corresponding typed function:

```java
getBooleanAssignment(...)
getNumericAssignment(...)
getIntegerAssignment(...)
getStringAssignment(...)
getJSONAssignment(...)
```

Each function has the same signature, but returns the type in the function name. For booleans use `getBooleanAssignment`, which has the following signature:

```java
public boolean getBooleanAssignment(
String flagKey,
String subjectKey,
Map<String, Object> subjectAttributes,
String defaultValue
)
```

## Assignment logger

To use the Eppo SDK for experiments that require analysis, pass in a callback logging function to the `init` function on SDK initialization. The SDK invokes the callback to capture assignment data whenever a variation is assigned. The assignment data is needed in the warehouse to perform analysis.

Here we define an implementation of the Eppo `IAssignmentLogger` interface containing a single function named `logAssignment`:

```java
import com.eppo.sdk.dto.IAssignmentLogger;
import com.eppo.sdk.dto.AssignmentLogData;

public class AssignmentLoggerImpl implements IAssignmentLogger {
public void logAssignment(AssignmentLogData event) {
...
}
}
```

## Philosophy

Eppo's SDKs are built for simplicity, speed and reliability. Flag configurations are compressed and distributed over a global CDN (Fastly), typically reaching your servers in under 15ms. Server SDKs continue polling Eppo’s API at 30-second intervals. Configurations are then cached locally, ensuring that each assignment is made instantly. Evaluation logic within each SDK consists of a few lines of simple numeric and string comparisons. The typed functions listed above are all developers need to understand, abstracting away the complexity of the Eppo's underlying (and expanding) feature set.

### Apple M-Series

Expand Down