-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Add events to the multi provider #568
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: Add events to the multi provider #568
Conversation
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…nagement Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…vider Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…n MultiProvider Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…r unsupported run modes Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
… state handling Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #568 +/- ##
==========================================
- Coverage 90.07% 89.52% -0.55%
==========================================
Files 77 77
Lines 2881 3084 +203
Branches 327 350 +23
==========================================
+ Hits 2595 2761 +166
- Misses 226 256 +30
- Partials 60 67 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
… error handling Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…sistency Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces event handling to the MultiProvider
, which is a significant and valuable feature. The implementation is well-structured and includes a comprehensive set of tests for the new functionality. I have identified a few areas for improvement to enhance robustness and performance:
- A potentially risky use of
Task.Run
in the constructor should be addressed to prevent unobserved exceptions. - The event processing loop can be made more efficient.
- A minor bug in a test helper method could lead to test timeouts.
Overall, this is a solid implementation of a complex feature. Addressing these points will further improve the quality of the code.
test/OpenFeature.Providers.MultiProvider.Tests/MultiProviderEventTests.cs
Outdated
Show resolved
Hide resolved
…mance and clarity Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…utdown Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…provider Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds event handling and status management capabilities to the MultiProvider class, enabling it to listen to events from underlying providers and emit appropriate events based on provider and aggregate status changes. The enhancement improves observability and provides specification-compliant event behavior for the multi-provider setup.
- Added comprehensive event infrastructure including event listening, status tracking, and proper event emission
- Implemented proper error handling during evaluation with event emission for unsupported run modes and general exceptions
- Enhanced shutdown and disposal processes to properly clean up event processing resources
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
TestProvider.cs | New test utility class providing basic FeatureProvider implementation for testing event scenarios |
MultiProviderEventTests.cs | Comprehensive test suite covering event emission, status transitions, and error handling scenarios |
MultiProviderTests.cs | Updated test to handle error details return instead of exception throwing for unsupported run modes |
OpenFeature.csproj | Added internal visibility for MultiProvider package to access OpenFeature internals |
README.md | Added documentation section explaining event handling behavior and lifecycle |
MultiProvider.cs | Core implementation of event handling infrastructure, status management, and proper cleanup |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
test/OpenFeature.Providers.MultiProvider.Tests/MultiProviderEventTests.cs
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
…event listeners Signed-off-by: GitHub <noreply@github.com>
…ries Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…mplement-events-in-multi-provider' into askpt/552-feature-implement-events-in-multi-provider
…ore adding Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
This PR
This pull request introduces event handling and status management improvements to the
MultiProvider
class in theOpenFeature.Providers.MultiProvider
package. The main changes include adding infrastructure to listen to events from underlying providers, emitting events based on provider and aggregate status changes, and ensuring proper shutdown of event processing. These enhancements improve observability and reliability of the multi-provider setup.Event Handling Infrastructure
MultiProvider
, including a dictionary to track event listening tasks and a cancellation token source for clean shutdown. Event listeners are started for all registered providers during initialization. [1] [2] [3]Event Emission and Status Management
MultiProvider
. Includes special handling for configuration change events.Shutdown and Disposal
Project Configuration
OpenFeature.csproj
to addInternalsVisibleTo
forOpenFeature.Providers.MultiProvider
, allowing internal access for testing and integration.Related Issues
Fixes #552
Notes