Repository navigation
Conversation
adilaijaz
commented
Mar 23, 2017
- Support for Traffic Allocations
- Introduced an ImpressionListener so we do not have to expose the label in the getTreatment.
- We no longer have the ability to set refresh rates to less than 30 seconds.
| if (_featuresRefreshRate <= 0) { | ||
| throw new IllegalArgumentException("featuresRefreshRate must be > 0: " + _featuresRefreshRate); | ||
| if (_featuresRefreshRate < 30 ) { | ||
| throw new IllegalArgumentException("featuresRefreshRate must be >= 30: " + _featuresRefreshRate); |
There was a problem hiding this comment.
should we not error out and set our default + logging WARN?
There was a problem hiding this comment.
tell me what you want and I can do that
|
|
||
| if (bucket >= parsedSplit.trafficAllocation()) { | ||
| // out of split | ||
| return new TreatmentLabelAndChangeNumber(parsedSplit.defaultTreatment(), "not in split", parsedSplit.changeNumber()); |
There was a problem hiding this comment.
Can this "not in split" be a constant in a LABELs class or enum like other SDKs?
Same for "killed", "exception" etc.
| final ImpressionListener impressionListener; | ||
|
|
||
| if (config.impressionListener() != null) { | ||
| AsynchronousImpressionListener wrapper = AsynchronousImpressionListener.build(config.impressionListener(), config.impressionListenerCapactity()); |
There was a problem hiding this comment.
in this branch of the if statement (when both listeners exist), which one executes first?
There was a problem hiding this comment.
when both listeners exist, then we create a federated listener of our listener (that uploads impressions to our endpoint) and theirs
| private final Long _changeNumber; | ||
|
|
||
|
|
||
| public Impression(String key, String bucketingKey, String split, String treatment, long time, String appliedRule, Long changeNumber) { |
There was a problem hiding this comment.
Don't we already have KeyImpression?
There was a problem hiding this comment.
we do, but that is an internal API. This is an API meant for external consumption. Reasons for keeping them separate:
- We may be in a world down the road where we are sending more data to ourselves than to an external API
- The internal api says 'label' and 'feature'. For external API, i am using 'appliedRule' and 'spilt' to be more consistent with the UI.
|
|
||
| @Test | ||
| public void getBucket() { | ||
| System.out.println(Splitter.getBucket("pato@split.io", 123)); |
| <module>client</module> | ||
| </modules> | ||
| <build> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
There was a problem hiding this comment.
what changed here? more dependencies?
There was a problem hiding this comment.
just the version number
| _debugEnabled = debugEnabled; | ||
| _labelsEnabled = labelsEnabled; | ||
| _impressionListener = impressionListener; | ||
| _impressionListenerCapacity = impressionListenerCapacity; |
There was a problem hiding this comment.
There is no default. The method in the builder is:
public Builder impressionListener(ImpressionListener impressionListener, int capacity) {
// code
}
which means that when you provide the impression listener, you also provide the capacity
| .setNameFormat("impression-listener-wrapper-%d") | ||
| .build(); | ||
|
|
||
| ExecutorService executor = new ThreadPoolExecutor(2, 2, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(capacity), threadFactory); |
There was a problem hiding this comment.
What's the rejection policy used?
There was a problem hiding this comment.
AbortPolicy. The wrapper catches any RejectedExecutions.
|




