Skip to content

Commit

Permalink
Merge branch 'main' into issue/828_fractional_relative_weighting
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
  • Loading branch information
aepfli committed Jun 19, 2024
2 parents ddbcc84 + 92a0499 commit 0ab0e71
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion providers/flagd/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ In vscode for instance, the following settings are recommended:
The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) using [`flagd`](https://github.com/open-feature/flagd). These tests do not run with the default maven profile. If you'd like to run them locally, you can start the flagd testbed with

```
docker-compose up -d
docker-compose up
```
and then run
```
Expand Down
16 changes: 4 additions & 12 deletions providers/flagd/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
services:
flagd:
build:
context: test-harness
dockerfile: flagd/Dockerfile
image: ghcr.io/open-feature/flagd-testbed:v0.5.4
ports:
- 8013:8013
flagd-unstable:
build:
context: test-harness
dockerfile: flagd/Dockerfile.unstable
image: ghcr.io/open-feature/flagd-testbed-unstable:v0.5.4
ports:
- 8014:8013
flagd-sync:
build:
context: test-harness
dockerfile: sync/Dockerfile
image: ghcr.io/open-feature/sync-testbed:v0.5.4
ports:
- 9090:9090
flagd-sync-unstable:
build:
context: test-harness
dockerfile: sync/Dockerfile.unstable
image: ghcr.io/open-feature/sync-testbed-unstable:v0.5.4
ports:
- 9091:9090
2 changes: 1 addition & 1 deletion providers/flagd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<!-- we only support unix sockets on linux, via epoll native lib -->
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.1.111.Final</version>
<version>4.1.110.Final</version>
<!-- TODO: with 5+ (still alpha), arm is support and we should package multiple versions -->
<classifier>linux-x86_64</classifier>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ public Object evaluate(List arguments, Object data) throws JsonLogicEvaluationEx
return distributeValue(bucketBy, propertyList, totalWeight);
}

private static String distributeValue(final String hashKey, final List<FractionProperty> propertyList, int totalWeight)
throws JsonLogicEvaluationException {
private static String distributeValue(
final String hashKey,
final List<FractionProperty> propertyList,
int totalWeight
) throws JsonLogicEvaluationException {
byte[] bytes = hashKey.getBytes(StandardCharsets.UTF_8);
int mmrHash = MurmurHash3.hash32x86(bytes, 0, bytes.length, 0);
float bucket = (Math.abs(mmrHash) * 1.0f / Integer.MAX_VALUE) * 100;
Expand Down Expand Up @@ -113,7 +116,7 @@ protected final void finalize() {
}

variant = (String) array.get(0);
if(array.size() >= 2) {
if (array.size() >= 2) {
// second element must be a number
if (!(array.get(1) instanceof Number)) {
throw new JsonLogicException("Second element of the fraction property is not a number");
Expand Down

0 comments on commit 0ab0e71

Please sign in to comment.