Skip to content

Conversation

@askpt
Copy link
Member

@askpt askpt commented Aug 26, 2025

This PR

This pull request introduces event handling and status management improvements to the MultiProvider class in the OpenFeature.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

  • Added event listening infrastructure to 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

  • Implemented logic to emit error and ready events during initialization and evaluation, improving visibility into provider failures and readiness. [1] [2]
  • Added logic to handle provider events, update individual provider statuses, and emit aggregate status change events for MultiProvider. Includes special handling for configuration change events.

Shutdown and Disposal

  • Ensured proper shutdown of event processing by cancelling event listeners and waiting for event tasks to complete during disposal.

Project Configuration

  • Updated OpenFeature.csproj to add InternalsVisibleTo for OpenFeature.Providers.MultiProvider, allowing internal access for testing and integration.

Related Issues

Fixes #552

Notes

  • I cannot get the coverage up to the requirements since there are some very edge cases that I cannot easily unit test. The proposed coverage is already good which covers most of the current implementation for events.

@askpt askpt linked an issue Aug 26, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 82.64840% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.52%. Comparing base (f43625c) to head (edd102a).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...enFeature.Providers.MultiProvider/MultiProvider.cs 82.64% 30 Missing and 8 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

@askpt askpt marked this pull request as ready for review August 26, 2025 21:14
@askpt askpt requested a review from a team as a code owner August 26, 2025 21:14
This was referenced Dec 22, 2025
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.

[FEATURE] Implement events in multi-provider

7 participants