-
Notifications
You must be signed in to change notification settings - Fork 73
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
WIP: integrating Yggdrasil #223
Conversation
@@ -76,6 +76,7 @@ public ClientFeaturesResponse fetchFeatures() throws UnleashException { | |||
FeatureCollection features = | |||
JsonFeatureParser.fromJson( | |||
Objects.requireNonNull(response.body()).charStream()); | |||
// TODO is this being used? Or HttpFeatureFetcher took over? |
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.
Can we delete OkHttpFeatureFetcher? I couldn't find valid references to it
} catch (YggdrasilInvalidInputException e) { | ||
LOG.error("Failed to take state", e); | ||
} |
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.
@sighphyre do you think this is ok?
return isEnabled(toggleName, contextProvider.getContext(), defaultSetting); | ||
try { | ||
UnleashContext enhancedContext = contextProvider.getContext().applyStaticFields(config); | ||
return Optional.ofNullable(unleashEngine.isEnabled(toggleName, adapt(enhancedContext))).orElse(defaultSetting); |
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.
UnleashEngine can return null when calling isEnabled and the SDK needs to handle this situation and provide a default value if present
// PR-comment: constraints are no longer managed by the SDK but by Yggdrasil, so we removed the third parameter | ||
verify(fallback).isEnabled(any(), any()); |
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.
I just wanted to double/triple check that it's ok to drop constraints parameters here
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.
@chriswk maybe you know, but this is a public interface we want to get rid of:
default boolean isEnabled( | |
Map<String, String> parameters, | |
UnleashContext unleashContext, | |
List<Constraint> constraints) { | |
return ConstraintUtil.validate(constraints, unleashContext) | |
&& isEnabled(parameters, unleashContext); |
The constraints are evaluated by Yggdrasil, and I believe this is just to do the evaluation in the SDK, but no one should ever extend this, but it's possible. So, I wonder how should we move this forward, we have the opportunity to make a hard-breaking change.
c7cc451
to
ba5370c
Compare
try { | ||
VariantDef variantResponse = this.unleashEngine.getVariant(toggleName, adapt(enhancedContext)); | ||
if (variantResponse != null) { | ||
return new FeatureEvaluationResult(variantResponse.isEnabled(), | ||
new Variant(variantResponse.getName(), adapt(variantResponse.getPayload()), variantResponse.isEnabled())); | ||
} |
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.
Should we always try to read variants first?
128b5fe
to
48811ed
Compare
255a577
to
10387e1
Compare
10387e1
to
3862610
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is a WIP PR with the idea of gathering early feedback. Note that this is intended to "Work on my machine"