-
Notifications
You must be signed in to change notification settings - Fork 36
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: eventing implementation #188
Conversation
Codecov Report
@@ Coverage Diff @@
## main #188 +/- ##
==========================================
+ Coverage 72.97% 77.03% +4.05%
==========================================
Files 8 9 +1
Lines 766 997 +231
==========================================
+ Hits 559 768 +209
- Misses 187 207 +20
- Partials 20 22 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Looks good to me overall, with a few nits (assuming the 1:N issue is fixed elsewhere).
correct, 1:N support was missing in this implementation and I am actively working on enabling this. |
84092c9
to
295a4eb
Compare
295a4eb
to
abee540
Compare
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com> Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com> Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
abee540
to
f98c9bb
Compare
This PR
Covers the initial implementation of #186
This PR introduces OpenFeature eventing spec [1] to Go SDK. The implementation is non-breaking and providers which plan to support eventing can opt-in by implementing
EventHandler
interface.Implementation
EventHandler
interface contains a single methodEventChannel() <- chan Event
. OpenFeature core implementation performs a type assertion on the provider forEventHandler
and listen toEvent
channel. It is provider implementation responsibility to emit spec-compliant events (ex:- ProviderReady when initialization is complete OR ProviderError when initialization failed)The core event handling logic is concentrated on
event_executor.go
. OpenFeature core implementation maintains a singleEventExecutor
instance that handles both global (api) level events and client level (scoped) events.Client and API both add and remove event handlers (callbacks) through their spec client accessors and these get stored at the global
EventExecutor
When handling events from providers, all global-level handlers are always invoked. But, the client (scoped) handlers only run if they are associated with the specific provider. This is done by comparing event payload's provider name & registered client name of the handler
Testing
Consider checking
event_executor_test.go
[2] to validate spec compliance as well as the correctness of the implementation[1] - https://github.com/open-feature/spec/blob/main/specification/sections/05-events.md#5-events
[2] - https://github.com/open-feature/go-sdk/blob/fe93b46b4afc11533b0530314cc71a823abfe705/pkg/openfeature/event_executor_test.go