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: Add Harness provider #348

Merged
merged 4 commits into from
Oct 31, 2023
Merged

feat: Add Harness provider #348

merged 4 commits into from
Oct 31, 2023

Conversation

liran2000
Copy link
Member

Add Harness GO Provider.

@davejohnston you are welcome to review from Harness point of view.

@Kavindu-Dodan @toddbaert you are welcome to review from OpenFeature perspective.

@liran2000 liran2000 requested a review from a team as a code owner October 12, 2023 17:32
@liran2000 liran2000 changed the title Add Harness provider feat: Add Harness provider Oct 12, 2023
Copy link

@davejohnston davejohnston left a comment

Choose a reason for hiding this comment

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

Hi @liran2000 thanks for putting this together. At a high level it looks good.
I'm just going to take one more look over it and then I'll approve.

We recently made a change in the goland SDK around initialisation which might help determine when the SDK is ready or not (once its connected and fetched all its config).

@toddbaert toddbaert self-requested a review October 16, 2023 19:12
Comment on lines +32 to +39
harnessClient, err := harness.NewCfClient(p.providerConfig.SdkKey, p.providerConfig.Options...)
if err != nil {
p.status = of.ErrorState
} else {
p.status = of.ReadyState
p.harnessClient = harnessClient
}
return err
Copy link
Member

Choose a reason for hiding this comment

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

Does harness include any sort of change events? We don't need it for first release, but we could maybe make an issue for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't see events in Harness GO SDK which can be mapped to provider events. If so then it can be address as a follow-up issue yes.

Choose a reason for hiding this comment

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

@liran2000 I think this is something we could add into the golang SDK. Currently we expose a func to tell you if it is initialised. We debated about exposing a channel to send the event on, but opted not to. I think what we can do is make it a option to pass into the constructor, where you can pass you're own channel in and get a single when we successfully init

Copy link
Member

Choose a reason for hiding this comment

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

I think that would be a cool feature. Personally I've always found change events in SDKs useful.

Comment on lines 283 to 288
switch key {
case "Identifier":
harnessTarget.Identifier = val
case "Name":
harnessTarget.Name = val
default:
Copy link
Member

@toddbaert toddbaert Oct 17, 2023

Choose a reason for hiding this comment

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

if Name or Identifier are special fields for identifying a target/user, we might want to map the targetingKey into one of these, and document which it is. We also may want to provide an option for which it's mapped to, if both are used for that purpose.

We also should specify what happens if targetingKey and one of these is set. I think targetingKey should take priority, since that is OpenFeatures designated identifier for a context. We may want to log a warning if that happens though.

Signed-off-by: liran2000 <[email protected]>
Signed-off-by: liran2000 <[email protected]>
@liran2000
Copy link
Member Author

Hi @liran2000 thanks for putting this together. At a high level it looks good. I'm just going to take one more look over it and then I'll approve.

Thanks @davejohnston, I made some changes according to comments, you can have a look and write here if you approve.

Comment on lines +22 to +24
Evaluation Context is mapped to Harness [target](https://developer.harness.io/docs/feature-flags/ff-sdks/server-sdks/feature-flag-sdks-go-application/#add-a-target).
OpenFeature targetingKey is mapped to _Identifier_, _Name_ is mapped to _Name_ and other fields are mapped to Attributes
fields.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@toddbaert toddbaert self-requested a review October 26, 2023 13:13
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.

LGTM, will merge pending @davejohnston 's approval.

Copy link

@davejohnston davejohnston 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 for you’re contribution

@toddbaert toddbaert merged commit a6940bc into open-feature:main Oct 31, 2023
5 checks passed
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.

4 participants