Code Monkey home page Code Monkey logo

java-sdk-contrib's People

Contributors

ajhelsby avatar beeme1mr avatar colebaileygit avatar dblanchard88 avatar fossabot avatar github-actions[bot] avatar itchyny avatar justinabrahms avatar kavindu-dodan avatar liran2000 avatar lopitz avatar madhead avatar markphelps avatar morganblanloeil avatar odubajdt avatar renovate[bot] avatar robbert229 avatar skyerus avatar thisthat avatar thiyagu06 avatar thomaspoignant avatar toddbaert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-sdk-contrib's Issues

[flagd] shutting down provider should reset the state.

https://github.com/open-feature/java-sdk-contrib/blob/main/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java#L56
It's not always guaranteed that FeatureProvider.shutdown() method is called at the end of application lifecycle. The user can call the shutdown method at any point in time of application lifetime. So it's better to reset the state. may be NOT_READY or new state and publish the event with the new state.

[env-var-provider] Replace OS class with an interface

See #244 (comment)

Minor comment (potential improvement)

We could make this an interface (contract) and have a default implementation based on System.getenv(name)

That would allow having custom env variable handling (ex:- prefixes, casing and even sources like spring configurations which come from different sources [1] ) and still use the same provider

Could be a follow up work :)

[1] - https://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/html/boot-features-external-config.html

Add automatic module names to all packages

See here, and the linked issue for details and background. This blog post is also helpful, specifically for library maintainers.

In each module in this project, we should add this maven step (we could also add it in the parent POM and somehow grab the name dynamically). We should be careful that the module name matches the "highest level" package in the module.

[flagd-provider] add events support

Once the java-sdk has events and init/shutdown support, we need to update the flagd-provider to emit events and do proper init/shutdown. We already have a stream implemented for cache-busing, so this should be pretty simple.

Definition of done:

  • flagd does does startup logic (like initializing its stream) in initialize function
  • flagd shuts down stream in close/shutdown function
  • flagd emits appropriate events on flag changes, and errors
  • associated testing

Blocked by:

Resources:

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
providers/flagd/docker-compose.yaml
github-actions
.github/workflows/ci.yml
  • actions/checkout v4@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • actions/setup-java v4@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • ghcr.io/open-feature/flagd-testbed v0.5.4
  • ghcr.io/open-feature/flagd-testbed-unstable v0.5.4
  • ghcr.io/open-feature/sync-testbed v0.5.4
  • ghcr.io/open-feature/sync-testbed-unstable v0.5.4
.github/workflows/component-owners.yml
  • dyladan/component-owners cdaadffde64c918909ee081e3fe044b8910f56c2
.github/workflows/lint-pr.yml
  • amannn/action-semantic-pull-request v5@e9fabac35e210fea40ca5b14c0da95a099eff26f
.github/workflows/release-please.yml
  • google-github-actions/release-please-action v4@a37ac6e4f6449ce8b3f7607e4d97d0146028dc0b
  • actions/checkout v4@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • actions/setup-java v4@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
maven
hooks/open-telemetry/pom.xml
  • io.opentelemetry:opentelemetry-bom 1.38.0
  • dev.openfeature:sdk [1.4,2.0)
  • io.opentelemetry:opentelemetry-semconv 1.30.1-alpha
pom.xml
  • dev.openfeature:sdk [1.0,2.0)
  • org.projectlombok:lombok 1.18.32
  • com.github.spotbugs:spotbugs 4.8.5
  • org.mockito:mockito-core 4.11.0
  • uk.org.lidalia:slf4j-test 1.2.0
  • org.assertj:assertj-core 3.25.3
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.junit.jupiter:junit-jupiter-engine 5.10.2
  • org.junit.jupiter:junit-jupiter-api 5.10.2
  • org.junit.jupiter:junit-jupiter-params 5.10.2
  • org.junit.platform:junit-platform-suite 1.10.2
  • org.mockito:mockito-junit-jupiter 4.11.0
  • org.mockito:mockito-inline 4.11.0
  • uk.org.webcompere:system-stubs-core 2.0.3
  • uk.org.webcompere:system-stubs-jupiter 2.1.6
  • io.cucumber:cucumber-java 7.17.0
  • io.cucumber:cucumber-junit-platform-engine 7.17.0
  • org.awaitility:awaitility 4.2.1
  • org.apache.maven.plugins:maven-compiler-plugin 3.13.0
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-checkstyle-plugin 3.3.1
  • com.puppycrawl.tools:checkstyle 8.45.1
  • org.apache.maven.plugins:maven-pmd-plugin 3.21.2
  • com.github.spotbugs:spotbugs-maven-plugin 4.8.5.0
  • com.h3xstream.findsecbugs:findsecbugs-plugin 1.13.0
  • com.github.spotbugs:spotbugs 4.8.5
  • org.apache.maven.plugins:maven-jar-plugin 3.4.1
  • org.honton.chas:exists-maven-plugin 0.7.0
  • org.apache.maven.plugins:maven-source-plugin 3.3.1
  • org.apache.maven.plugins:maven-javadoc-plugin 3.6.3
  • org.cyclonedx:cyclonedx-maven-plugin 2.8.0
  • org.apache.maven.plugins:maven-gpg-plugin 3.2.4
  • org.sonatype.plugins:nexus-staging-maven-plugin 1.6.13
providers/configcat/pom.xml
  • com.configcat:configcat-java-client 9.1.2
  • org.slf4j:slf4j-api 2.0.13
  • org.apache.logging.log4j:log4j-slf4j2-impl 2.23.1
providers/env-var/pom.xml
  • org.apache.commons:commons-lang3 3.14.0
providers/flagd/pom.xml
  • dev.openfeature:sdk [1.4,2.0)
  • io.grpc:grpc-netty 1.63.0
  • io.grpc:grpc-protobuf 1.63.0
  • io.grpc:grpc-stub 1.63.0
  • io.netty:netty-transport-native-epoll 4.1.109.Final
  • com.fasterxml.jackson.core:jackson-databind 2.17.1
  • io.github.jamsesso:json-logic-java 1.0.7
  • com.google.code.gson:gson 2.10.1
  • com.networknt:json-schema-validator 1.4.0
  • org.apache.tomcat:annotations-api 6.0.53
  • org.apache.commons:commons-collections4 4.4
  • io.opentelemetry:opentelemetry-api 1.38.0
  • org.semver4j:semver4j 5.3.0
  • commons-codec:commons-codec 1.17.0
  • kr.motd.maven:os-maven-plugin 1.7.1
  • org.codehaus.mojo:exec-maven-plugin 3.2.0
  • org.xolstice.maven.plugins:protobuf-maven-plugin 0.6.1
  • org.codehaus.mojo:exec-maven-plugin 3.2.0
providers/flagsmith/pom.xml
  • com.flagsmith:flagsmith-java-client 7.3.0
  • com.squareup.okhttp3:okhttp 4.12.0
  • com.squareup.okhttp3:mockwebserver 4.12.0
providers/flipt/pom.xml
  • io.flipt:flipt-java 1.1.1
  • org.slf4j:slf4j-api 2.0.13
  • com.github.tomakehurst:wiremock-jre8 2.35.2
  • com.fasterxml.jackson.core:jackson-core 2.17.1
  • com.fasterxml.jackson.core:jackson-databind 2.17.1
  • com.fasterxml.jackson.core:jackson-annotations 2.17.1
  • org.apache.logging.log4j:log4j-slf4j2-impl 2.23.1
providers/go-feature-flag/pom.xml
  • com.fasterxml.jackson.datatype:jackson-datatype-jsr310 2.17.1
  • com.fasterxml.jackson.core:jackson-databind 2.17.1
  • com.squareup.okhttp3:okhttp 4.12.0
  • com.squareup.okhttp3:mockwebserver 4.12.0
  • com.google.guava:guava 33.2.0-jre
  • org.slf4j:slf4j-api 2.0.13
  • org.apache.logging.log4j:log4j-slf4j2-impl 2.23.1
providers/jsonlogic-eval-provider/pom.xml
  • io.github.jamsesso:json-logic-java 1.0.7
  • org.json:json 20240303
  • com.github.spotbugs:spotbugs-annotations 4.8.5
providers/statsig/pom.xml
  • com.statsig:serversdk 1.17.3
  • org.slf4j:slf4j-api 2.0.13
  • org.apache.logging.log4j:log4j-slf4j2-impl 2.23.1
providers/unleash/pom.xml
  • io.getunleash:unleash-client-java 9.2.1
  • org.slf4j:slf4j-api 2.0.13
  • com.github.tomakehurst:wiremock-jre8 2.35.2
  • org.apache.logging.log4j:log4j-slf4j2-impl 2.23.1

  • Check this box to trigger a request for Renovate to run again on this repository

OTel Span in flagd Provider

The flagd provider should start an OTel span that will be passed to flagd to get cross-service tracing for evaluation.

[FlagD] Refactor package structure and offload some responsibilities from FlagdProvider

Problems

  • Everything is bundled together into a single namespace which makes it hard to understand the responsibilities of each class.
  • The current main commit allows for external entities to change the internal state of the communication of Flagd Provider. IMHO we should remove this from the API surface.
  • Unit and Integration tests are hard to write
  • Review opportunities to add log.debug statements

Suggestion

Refactor into modules as proposed:
image

Add CODEOWNERS

Add a CODEOWNERS file with appropriate persons per artifact, as well as root-level CODEOWNERS.

[flagd] implement `flagd.feature` gherkin test suite

We don't yet have e2e tests for flag changes or zero-value flags.

These are both defined in the flagd.feature test suite, and supported by the sync-testbed and flagd-testbed containers.

Tasks:

  • add matching steps defined in the feature file to the steps
    • note the Flag change event should fire automatically from both testbed containers, so there's no need to manually change the flags
  • load the feature file in both cucumber runs (RPC and in-process)

[flagd] Include scope as flag evaluation metadata

flagd includes scope as a flag evaluation metadata 1 which correlates to grpc proxy selector 2. Given in-process evaluator can works with grpc proxy, we can include scope in in-process implementation.

Acceptance Criteria

In-process provider with grpc flag syncs includes selector as scope in flag evaluation metadata similar to flagd implementation.

Footnotes

  1. https://github.com/open-feature/flagd/blob/main/core/pkg/evaluator/json.go#L305-L308^

  2. https://flagd.dev/reference/sync-configuration/#source-configuration

[flagd] Add `$flagd.timestamp` to in-process evalutor

The flagd in-process evaluator needs to have $flagd.timestamp added, so that users can write time-based JsonLogic rules.

See here for doc, and here for the flagd-standalone implementation.

You'll need to add a standard unix timestamp (seconds since 1970) to the evaluation context, similar to the flagKey, here.

[flagd-provider] fix non-conformant config options

Currently the flagd provider doesn't default to unlimited retries, and doesn't throw immediately if it can't start.

See: https://github.com/open-feature/flagd/blob/main/docs/other_resources/creating_providers.md#environment-variables and https://github.com/open-feature/flagd/blob/main/docs/other_resources/creating_providers.md#provider-lifecycle-initialization-and-shutdown

Definition of done:

  • update the flagd provider to default to 0 (infinite) retries
  • verify other defaults

Flagsmith classes not public

Flagsmith provider class and option class was created using package restricted access, so examples doesn't work.

[flagd-provider] add unit test for zero-value resolutions from flagd

Flagd sends empty values in flag response payloads when the value is equivalent to the zero-value of the associated go type. We should test that this works as expected and still returns an equivalent zero-value (ie: false, 0).

DoD:

  • manual test confirming zero values are returned from the flagd provider when they are missing from the gRPC message (boolean set to false or numeric set to 0 in flagd config)
  • new tests that assert correct values for zero-value flags

see: open-feature/flagd#218

[flagd] validate race conditions of in-process provider

As suggested by this comment, our concurrency logic needs to be validated for race conditions. Though we expect initialization to be called once, there could be edge cases such as multiple provider registrations which could invoke unwanted initialization attempts.

Acceptance Criteria

In-process provider implementation is validated for potential race conditions and fixed.

[flagd] NPE with null valued contexts

flagd's convertPrimitive(Value) results in an NPE as we explicitly set null [1] for context null values.

This must be corrected by using NullValue [2], which allows the representation to accept null values.

[1] - https://github.com/open-feature/java-sdk-contrib/blob/dev.openfeature.contrib.providers.flagd-v0.5.7/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java#L389
[2] - https://protobuf.dev/reference/java/api-docs/com/google/protobuf/NullValue.html

[flagd] Intial version of in-process provider

As mentioned in flagd documentation of Creating an in-process flagd provider 1, in-process provider comes with unique advantages. This issue focuses on creating the first version of flagd in-process provider in Java.

Requirements

  • Fulfill requirements outlined by flagd in-process guideline 1
  • Minimal external dependencies
  • Updated/New ReadMe & usage guide
  • Unit & Integration tests

Technical requirements

  • Use the same repository directory structure (providers/flagd)
  • Build both remote and in-process providers into a single dependency (To be decided after the POC)
  • Reuse existing interfaces and implementations where possible

Tasks

  • POC implementation and build to detect packaging requirements (no evaluations needed)
  • In-process provider with gRPC flag sync capability on basic flags
  • Support for JsonLogic evaluators (complex flagd flag configurations)
  • Support for flagd custom JsonLogic evaluators

Footnotes

  1. https://github.com/open-feature/flagd/blob/main/docs/other_resources/in-process-providers/specification.md 2

[flagd] follow-up refactoring

Tasks

Add OTel Hook

Now that OTel 2529 is merged, we should implement the Open Telemetry hook (currently exists as a stub).

Basically, this would entail creating a hook which:

  • in the after stage: gets the current span and adds an appropriately named event (feature_flag), with the attributes (feature_flag.key, feature_flag.provider_name, and feature_flag.variant)
  • in the error stage, records the exception

In pseudocode, this looks something like:

class OTelHook implements Hook {
  after(context, details) {
    var currentTrace = trace.getActiveSpan();
    currentTrace.addEvent("feature_flag", { "feature_flag.key": details.key, /*  other props */ } );
  }

  error(err) {
    var currentTrace = trace.getActiveSpan();
    currentTrace.recordException(err);
  }
}

See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/feature-flags.md

[flagd provider] align with configuration in JS and go version, add env support

The JS and Go version options look like this:

| Option name | Environment variable name | Type    | Default   |
| ----------- | ------------------------- | ------- | --------- |
| host        | FLAGD_HOST                | string  | localhost |
| port        | FLAGD_PORT                | number  | 8013      |
| tls         | FLAGD_TLS                 | boolean | false     |
| socketPath  | FLAGD_SOCKET_PATH         | string  | -         |
| certPath    | FLAGD_SERVER_CERT_PATH    | string  | -         |

We need to change the config to look like this, and add certPath and socketPath support.

This will also fix a bug with an unexported Protocol enum.

[env-var-provider] Suppot keys transformation

See #244 (comment):

One thing we've done in other ENV VAR providers is to map SCREAMING_SNAKE_CASE env vars to hyphen-case-keys. This may be desirable, since generally people like to use SCREAMIN_SNAKE for env vars, but that's generally not true for feature flag keys.

You could also create some transformer interface to allow users to control this translation.... and it doesn't have to be done in this PR.

Remove deprecated methods of flagd

Goal

Remove the methods annotated with @Deprecated in providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java

Technical Details

With #294, several methods are deprecated because we moved to a builder pattern. We should remove them and the respective test code.

Dependencies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.