Skip to content

feat: ISSUE-658 go-feature-flag sdk - add cache #369

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

Merged
Merged
Show file tree
Hide file tree
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
23 changes: 15 additions & 8 deletions providers/go-feature-flag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,34 @@ GO Feature Flag provider allows you to connect to your [GO Feature Flag relay pr

## How to use this provider?

To initialize your instance please follow this example:
To use your instance please follow this example:

```java
import dev.openfeature.contrib.providers.gofeatureflag;

// ...
new GoFeatureFlagProvider(
FeatureProvider provider = new GoFeatureFlagProvider(
GoFeatureFlagProviderOptions
.builder()
.endpoint("https://my-gofeatureflag-instance.org")
.timeout(1000)
.build());
// ...
provider.shutdown();
```

You will have a new instance ready to be used with your `open-feature` java SDK.

### Options

| name | mandatory | Description |
|--------------------------|-----------|----------------------------------------------------------------------------------------------------------------|
| **`endpoint`** | `true` | endpoint contains the DNS of your GO Feature Flag relay proxy _(ex: https://mydomain.com/gofeatureflagproxy/)_ |
| **`timeout`** | `false` | timeout in millisecond we are waiting when calling the go-feature-flag relay proxy API. _(default: 10000)_ |
| **`maxIdleConnections`** | `false` | maxIdleConnections is the maximum number of connexions in the connexion pool. _(default: 1000)_ |
| **`keepAliveDuration`** | `false` | keepAliveDuration is the time in millisecond we keep the connexion open. _(default: 7200000 (2 hours))_ |
| name | mandatory | Description |
|--------------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **`endpoint`** | `true` | endpoint contains the DNS of your GO Feature Flag relay proxy _(ex: https://mydomain.com/gofeatureflagproxy/)_ |
| **`timeout`** | `false` | timeout in millisecond we are waiting when calling the go-feature-flag relay proxy API. _(default: 10000)_ |
| **`maxIdleConnections`** | `false` | maxIdleConnections is the maximum number of connexions in the connexion pool. _(default: 1000)_ |
| **`keepAliveDuration`** | `false` | keepAliveDuration is the time in millisecond we keep the connexion open. _(default: 7200000 (2 hours))_ |
| **`apiKey`** | `false` | If the relay proxy is configured to authenticate the requests, you should provide an API Key to the provider. Please ask the administrator of the relay proxy to provide an API Key. (This feature is available only if you are using GO Feature Flag relay proxy v1.7.0 or above). _(default: null)_ |
| **`enableCache`** | `false` | enable cache value. _(default: true)_ |
| **`cacheBuilder`** | `false` | If cache custom configuration is wanted, you should provide a cache builder. _(default: null)_ |
| **`flushIntervalMs`** | `false` | interval time we publish statistics collection data to the proxy. The parameter is used only if the cache is enabled, otherwise the collection of the data is done directly when calling the evaluation API. _(default: 1000 ms)_ |
| **`maxPendingEvents`** | `false` | max pending events aggregated before publishing for collection data to the proxy. When event is added while events collection is full, event is omitted. _(default: 10000)_ |
20 changes: 20 additions & 0 deletions providers/go-feature-flag/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,25 @@
<version>4.11.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.20.0</version>
<scope>test</scope>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dev.openfeature.contrib.providers.gofeatureflag;

import dev.openfeature.sdk.ProviderEvaluation;
import lombok.Builder;
import lombok.Getter;

/**
* EvaluationResponse wrapping the provider evaluation.
* @param <T> evaluation type
*/
@Builder
@Getter
public class EvaluationResponse<T> {
private ProviderEvaluation<T> providerEvaluation;
private Boolean cachable;
}
Loading