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: Expose set sdk metadata #166

Merged
merged 5 commits into from
Jun 17, 2024
Merged

feat: Expose set sdk metadata #166

merged 5 commits into from
Jun 17, 2024

Conversation

vahidlazio
Copy link
Contributor

No description provided.

Comment on lines 60 to 64
fun setSdk(sdk: SdkMetadata) {
(flagResolver as RemoteFlagResolver).setSdk(sdk)
(eventSenderEngine as EventSenderEngineImpl).setSdk(sdk)
(flagApplierClient as FlagApplierClientImpl).setSdk(sdk)
}
Copy link
Member

Choose a reason for hiding this comment

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

Is it really not possible to only support passing it in the create() function?

Having it mutable isn't really something we want to support, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes but then what would be the default? if someone wants to use confidence in conjunction with open feature, do we really want to force them to pass the correct Id or additional parameter when creating confidence? or we want to do it automatically?
another way is to pass the apiKey and other confidence parameters to the provider creation function and then provider to create the confidence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can make it immutable but take into account that users of open feature, in order to have the correct id, should pass SDK_ID_KOTLIN_PROVIDER, and then my worry is, it will be easy for them to just not do it and our telemetry will be incorrect.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... I didn't think about the OpenFeature provider case but purely for Flutter...

Can we explore different naming for create functions depending on the use case?

Or I wonder if we can pivot on the creation of the OF provider somehow to have it create the Confidence-instance behind the scenes or something? -- a bit strange since we likely want to also keep the reference to Confidence.

Copy link
Contributor Author

@vahidlazio vahidlazio Jun 14, 2024

Choose a reason for hiding this comment

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

"a bit strange since we likely want to also keep the reference to Confidence."
exactly!
for flutter, I already added in this PR the sdk: SdkMetadata parameter which can be passed in create function. setSdk is/will be called only within the provider context.

…or creating confidence with the correct sdk id
Copy link
Member

@fabriziodemaria fabriziodemaria left a comment

Choose a reason for hiding this comment

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

My comment is just an idea, disregard if you want to merge

initialContext: Map<String, ConfidenceValue> = mapOf(),
region: ConfidenceRegion = ConfidenceRegion.GLOBAL,
dispatcher: CoroutineDispatcher = Dispatchers.IO
): Confidence {
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if we could introduce a new interface ConfidenceForOpenFeature or something, and make the create function below accept that, as a way to force users to use this createConfidence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this case ConfidenceForOpenFeature should inherit both from event sender and from Contextual

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and all other functions are from confidence object itself, we don't have a confidence interface currently.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps worth exploring, but I am also not strongly convinced these extra interfaces will actually help the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you agree taking this in another PR and moving forward with this PR?

@vahidlazio vahidlazio merged commit 10548d9 into main Jun 17, 2024
2 checks passed
fabriziodemaria added a commit that referenced this pull request Jun 25, 2024
fabriziodemaria added a commit that referenced this pull request Jun 25, 2024
* Revert "refactor: Add ConfidenceForOF proxy for safe init (#167)"

This reverts commit e177c5b.

* Revert "feat: Expose set sdk metadata (#166)"

This reverts commit 10548d9.

* Fix ID in Provider
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.

3 participants