-
Notifications
You must be signed in to change notification settings - Fork 39
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: implemented support for tracking #1228
base: main
Are you sure you want to change the base?
Conversation
import dev.openfeature.sdk.exceptions.GeneralError; | ||
import dev.openfeature.sdk.exceptions.OpenFeatureError; | ||
import dev.openfeature.sdk.exceptions.ProviderNotReadyError; | ||
import dev.openfeature.sdk.exceptions.*; |
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.
please no star imports
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.
Thanks! I think the IDE "optimized" this. I need to figure out how to configure IntelliJ to avoid wildcard imports for regular files while still allowing them for test files. This is probably still useful for things like static imports of Mockito assertions in tests...
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 started with #1098 i should finish it, to prevent this in the future
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1228 +/- ##
============================================
+ Coverage 93.07% 93.46% +0.39%
- Complexity 441 451 +10
============================================
Files 41 42 +1
Lines 1025 1056 +31
Branches 85 85
============================================
+ Hits 954 987 +33
+ Misses 44 43 -1
+ Partials 27 26 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thank you the changes look good, but please remove the start imports, and (personal preference) use assertJ for assertions. Plus the comment i wrote regarding the assertCode
client.track("event"); | ||
client.track("event", ctx); | ||
client.track("event", details); | ||
client.track("event", ctx, details); |
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.
[suggestion] This code looks like it has no purpose, but we check if the code runs without issue. we should add here an assertion, to make it clear what the purpose is. we do have AssertJ available and there is assertThatCode(() -> {})..doesNotThrowAnyException();
see assertJ docs
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 think the intention was to explicitly "test" that the API aligns with the spec design. I wasn’t aware of AssertJ—thanks!
12cb85e
to
7831008
Compare
Signed-off-by: Bernd Warmuth <[email protected]>
7831008
to
d40050f
Compare
I will wait for a few more days, to give other @open-feature/sdk-java-maintainers the possibility to respond before merging this. Thank you for the contribution |
Will review tomorrow! |
I will also have a look tomorrow if I find time :) |
@@ -1,5 +1,6 @@ | |||
package dev.openfeature.sdk; | |||
|
|||
import javax.annotation.Nullable; |
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.
We don't allow usage of javax. We actually removed it from the SDK some time ago because it's very explicitly not allowed at some orgs, but it comes in transitively to this repo. Believe it or not, the Nullable
annotation is present at runtime too.
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.
Out of curiosity are there other classes which should not be used, might be worth adding archUnit tests preventing those imports. But we should define a list for that.
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.
Dropped the @nullable hint (even though it would've been a nice touch).
Maybe we could consider creating our own annotation for that?
*/ | ||
@EqualsAndHashCode | ||
@ToString | ||
public class MutableTrackingEventDetails implements TrackingEventDetails { |
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 think to be consistent with the rest if the SDK we should also implement a ImutableTrackingEventDetails
.
Not exactly a blocker for me but I think it would be a good idea.
@@ -19,6 +11,16 @@ | |||
import lombok.Getter; | |||
import lombok.extern.slf4j.Slf4j; | |||
|
|||
import javax.annotation.Nullable; |
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.
|
||
|
||
@Getter | ||
private final float target; |
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.
private final float target; | |
private final float value; |
Looks like a copy/paste error here - this should be called value
. I also think Number
would be a better type since it will support all kinds of precision scenarios.
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.
Defintely on the right track, please see:
- https://github.com/open-feature/java-sdk/pull/1228/files#r1860724481
- https://github.com/open-feature/java-sdk/pull/1228/files#r1860735063
In particular. These are blockers from my POV.
Signed-off-by: Bernd Warmuth <[email protected]>
Quality Gate passedIssues Measures |
This PR
Related Issues
Fixes #1164