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

feat: events #476

Merged
merged 20 commits into from
Jul 12, 2023
Merged

feat: events #476

merged 20 commits into from
Jul 12, 2023

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Jun 14, 2023

This PR:

  • makes some changes to initialization to set providers before waiting for them to be ready, as discussed in this thread.
  • implements provider events:
    • Provider authors can now optionally extend EventProvider and emit events with this.eventEmitter.emit(event, details); (and it's similar convenience methods)
    • Application authors can add handlers to clients or the API with ...on(event, handler) where handler is a java.util.function.Consumer<EventDetails> and it's convenience methods.
    • when providers finish initializing, PROVIDER_READY / PROVIDER_ERROR are emitted automatically depending on it's success.

See the tests in EventsTest.java to get a feel for the API.

Fixes: #475
Fixes: #440

@toddbaert toddbaert requested a review from a team as a code owner June 14, 2023 20:05
@toddbaert toddbaert force-pushed the feat/events branch 3 times, most recently from bc6622a to ebff404 Compare June 14, 2023 21:09
@open-feature open-feature deleted a comment from codecov bot Jun 14, 2023
@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Merging #476 (7eebd01) into main (893d0da) will increase coverage by 0.78%.
The diff coverage is 98.95%.

@@             Coverage Diff              @@
##               main     #476      +/-   ##
============================================
+ Coverage     94.44%   95.23%   +0.78%     
- Complexity      268      329      +61     
============================================
  Files            25       31       +6     
  Lines           612      755     +143     
  Branches         36       37       +1     
============================================
+ Hits            578      719     +141     
- Misses           17       19       +2     
  Partials         17       17              
Flag Coverage Δ
unittests 95.23% <98.95%> (+0.78%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...java/dev/openfeature/sdk/internal/ObjectUtils.java 100.00% <ø> (ø)
...n/java/dev/openfeature/sdk/ProviderRepository.java 98.36% <96.00%> (-1.64%) ⬇️
.../main/java/dev/openfeature/sdk/OpenFeatureAPI.java 98.90% <98.46%> (-1.10%) ⬇️
...rc/main/java/dev/openfeature/sdk/EventDetails.java 100.00% <100.00%> (ø)
...c/main/java/dev/openfeature/sdk/EventProvider.java 100.00% <100.00%> (ø)
...rc/main/java/dev/openfeature/sdk/EventSupport.java 100.00% <100.00%> (ø)
...main/java/dev/openfeature/sdk/FeatureProvider.java 100.00% <100.00%> (ø)
...rc/main/java/dev/openfeature/sdk/NoOpProvider.java 100.00% <100.00%> (ø)
...in/java/dev/openfeature/sdk/OpenFeatureClient.java 98.01% <100.00%> (+0.17%) ⬆️
...c/main/java/dev/openfeature/sdk/ProviderEvent.java 100.00% <100.00%> (ø)
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

pom.xml Outdated Show resolved Hide resolved
toddbaert and others added 12 commits July 10, 2023 09:40
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert
Copy link
Member Author

@open-feature/sdk-java-approvers @open-feature/sdk-java-maintainers I'll be merging this tomorrow EOD unless I hear objections! If you intend to review it and you'd like me to hold-off, or you have any concerns, let me know.

This implementation is quite close the to go/js impls, and as far as I can tell is spec adherent.

toddbaert and others added 3 commits July 11, 2023 10:54
Co-authored-by: Justin Abrahms <jabrahms@ebay.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@sonarcloud
Copy link

sonarcloud bot commented Jul 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 23 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@justinabrahms justinabrahms merged commit bad5b0a into main Jul 12, 2023
8 checks passed
@justinabrahms justinabrahms deleted the feat/events branch July 12, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug?] initialize should accept global context Implement events
8 participants