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: implement provider events #278

Merged
merged 13 commits into from
Mar 21, 2024
Merged

Conversation

federicobond
Copy link
Member

@federicobond federicobond commented Feb 21, 2024

This PR

  • Adds support for eventing according to the spec. Looking for feedback especially on the public API

Follow-up Tasks

  • Improve tests
  • Run event handlers with a ThreadPoolExecutor

Fixes: #278

Copy link

codecov bot commented Feb 21, 2024

Codecov Report

Attention: Patch coverage is 98.16514% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 94.77%. Comparing base (04b4009) to head (d4420f3).

Files Patch % Lines
openfeature/_event_support.py 97.50% 1 Missing ⚠️
openfeature/provider/provider.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
+ Coverage   94.19%   94.77%   +0.58%     
==========================================
  Files          18       20       +2     
  Lines         551      651     +100     
==========================================
+ Hits          519      617      +98     
- Misses         32       34       +2     
Flag Coverage Δ
unittests 94.77% <98.16%> (+0.58%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

README.md Outdated Show resolved Hide resolved
@toddbaert
Copy link
Member

I'll take a close look at this in the next couple days.

openfeature/event.py Outdated Show resolved Hide resolved
openfeature/event.py Outdated Show resolved Hide resolved
tests/test_client.py Outdated Show resolved Hide resolved
@toddbaert toddbaert self-requested a review February 28, 2024 17:38
Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pardon my lack of Python skills if I'm missed something.

Overall the structures and API look great!

I left some requested changes specifically on the finer points of the eventing spec. They can be tricky, and some of it could be better fleshed-out in the spec, as I think you noted before. I will work on some additional supporting explanations today. Thanks for your efforts here! 🙏

@toddbaert
Copy link
Member

@federicobond I've opened open-feature/spec#248

@federicobond federicobond force-pushed the events branch 5 times, most recently from 8cb80f5 to 17b3369 Compare March 7, 2024 22:32
@federicobond
Copy link
Member Author

This should be ready to review from a specification perspective, we might want to add some further tests maybe.

@federicobond federicobond linked an issue Mar 9, 2024 that may be closed by this pull request
3 tasks
Copy link
Member

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@federicobond I've added a few comments here from a python perspective but I don't purport to be an expert so feel free to ignore as you see fit!

openfeature/client.py Outdated Show resolved Hide resolved
openfeature/event.py Outdated Show resolved Hide resolved
openfeature/event.py Outdated Show resolved Hide resolved
openfeature/provider/provider.py Outdated Show resolved Hide resolved
openfeature/provider/registry.py Outdated Show resolved Hide resolved
@federicobond
Copy link
Member Author

From Requirement 5.1.1:

Providers cannot emit PROVIDER_CONTEXT_CHANGED or PROVIDER_RECONCILING event.

Should we add a guard to make sure this cannot happen?

Copy link
Member

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delay in responding here @federicobond, I really need to look into my GH notifications 🙄

I've added a few more comments in response to yours. Again, I'm happy to be ignored on any of them if you see fit.

openfeature/client.py Outdated Show resolved Hide resolved
openfeature/event.py Outdated Show resolved Hide resolved
openfeature/provider/provider.py Outdated Show resolved Hide resolved
openfeature/provider/registry.py Outdated Show resolved Hide resolved
@federicobond
Copy link
Member Author

@matthewelwell I refactored the EventSupport implementation so that we are no longer using private module imports. It should be much cleaner now.

Copy link
Member

@gruebel gruebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work, just few minor comments/questions

openfeature/_event_support.py Show resolved Hide resolved
openfeature/_event_support.py Show resolved Hide resolved
openfeature/_event_support.py Show resolved Hide resolved
openfeature/event.py Show resolved Hide resolved
openfeature/provider/provider.py Show resolved Hide resolved
Copy link
Member

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @federicobond !

Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
…ssociated state

Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
…er_status

Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
@federicobond federicobond dismissed toddbaert’s stale review March 21, 2024 20:44

All issues resolved.

@federicobond federicobond merged commit 679409f into open-feature:main Mar 21, 2024
11 of 12 checks passed
@federicobond federicobond deleted the events branch March 21, 2024 20:45
@federicobond
Copy link
Member Author

Merged! 🎉 Thanks everyone for your helpful comments and suggestions.

@beeme1mr
Copy link
Member

Amazing, nice job @federicobond!

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.

Implement API-Level Events
5 participants