feat: Create interface for eval events. #1288
feat: Create interface for eval events. #1288Kavindu-Dodan merged 1 commit intoopen-feature:mainfrom
Conversation
✅ Deploy Preview for polite-licorice-3db33c canceled.
|
a087eca to
8a89c26
Compare
|
would like to mount an eval service in an existing server, but don't see a way I can get this working without EventingConfiguration being exported. It is possible I am breaking the warranty seal here, but this is pseudo code of what I'm trying to do: func (f *flagdWrapper) Init(ctx context.Context) error {
log := logging.GetLogger().With("component", "flagd.evaluation.v1").Desugar()
reqIDLogging := false
logger := logger.NewLogger(log, reqIDLogging)
marshalOpts := flagdService.WithJSON(
protojson.MarshalOptions{EmitUnpopulated: true},
protojson.UnmarshalOptions{DiscardUnknown: true},
)
var (
eval evaluator.IEvaluator
metricsRecorder *telemetry.MetricsRecorder
)
evalSvc := flagdService.NewFlagEvaluationService(
logger, eval, nil /*eventingCfg*/, metricsRecorder,
)
_, flagdHandler := evaluationV1.NewServiceHandler(evalSvc, marshalOpts)
prefix := "/flagd.evaluation.v1.Service/"
service.MustGetHTTPServeMux(ctx).
Handle(prefix, flagdHandler)
return f.Initializer.Init(ctx)
} |
Thank you for showing the intended usage of the service. I proposed a few improvements to the PR so that it improves testability and makes component interactions clearer. However, you should understand that as maintainers we cannot guarantee backward compatibility of the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1288 +/- ##
==========================================
+ Coverage 73.69% 77.25% +3.56%
==========================================
Files 32 20 -12
Lines 3140 1618 -1522
==========================================
- Hits 2314 1250 -1064
+ Misses 717 286 -431
+ Partials 109 82 -27 ☔ View full report in Codecov by Sentry. |
20d0408 to
ffa1919
Compare
Kavindu-Dodan
left a comment
There was a problem hiding this comment.
Changes looks good 🎉
@connyay could you please rebase and add DCO signature to commits. You can check the guide here - https://github.com/open-feature/flagd/pull/1288/checks?check_run_id=24131045370
Before this change the eval services used a unexported struct which prevented creating eval services outside of this package. This change creates a new IEvents interface that allows providing custom impls of flag eval services. Signed-off-by: Connor Hindley <connor.hindley@tanium.com>
ffa1919 to
b38764d
Compare
Totally understand. Appreciate you still being open to this PR even with that being said 👍 |
👍 you're welcome. Please continuously check flagd releases for any important changes. I will merge this when other maintainers approve |
There was a problem hiding this comment.
I'm fine with this, given the caveats @Kavindu-Dodan mentioned.
🤖 I have created a release *beep* *boop* --- <details><summary>flagd: 0.10.2</summary> ## [0.10.2](flagd/v0.10.1...flagd/v0.10.2) (2024-05-10) ### ✨ New Features * Create interface for eval events. ([#1288](#1288)) ([9714215](9714215)) ### 🧹 Chore * bump go deps to latest ([#1307](#1307)) ([004ad08](004ad08)) </details> <details><summary>flagd-proxy: 0.6.2</summary> ## [0.6.2](flagd-proxy/v0.6.1...flagd-proxy/v0.6.2) (2024-05-10) ### 🧹 Chore * bump go deps to latest ([#1307](#1307)) ([004ad08](004ad08)) </details> <details><summary>core: 0.9.2</summary> ## [0.9.2](core/v0.9.1...core/v0.9.2) (2024-05-10) ### ✨ New Features * improve error log and add flag disabled handling for ofrep ([#1306](#1306)) ([39ae4fe](39ae4fe)) ### 🧹 Chore * bump go deps to latest ([#1307](#1307)) ([004ad08](004ad08)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR
Before this change the eval services used a unexported
struct which prevented creating eval services outside of
this package.
This change creates a new IEvents interface that allows
providing custom impls of flag eval services.
Related Issues
Notes
Follow-up Tasks
How to test