-
Notifications
You must be signed in to change notification settings - Fork 18
Pluggable BulletRecord #28
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
Conversation
public BulletConfig(String file) { | ||
super(file, DEFAULT_CONFIGURATION_NAME); | ||
VALIDATOR.validate(this); | ||
bulletRecordProvider = BulletRecordProvider.from((String) get(RECORD_PROVIDER_CLASS_NAME)); |
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.
use getAs?
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.
What getAs?
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.
public BulletConfig() { | ||
super(DEFAULT_CONFIGURATION_NAME); | ||
VALIDATOR.validate(this); | ||
bulletRecordProvider = BulletRecordProvider.from((String) get(RECORD_PROVIDER_CLASS_NAME)); |
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.
ditto
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.
For all instance variables, can we s/bulletRecordProvider/recordProvider or even provider?
sketch = threshold != null ? new FrequentItemsSketch(errorType, maxMapSize, threshold.longValue(), size) : | ||
new FrequentItemsSketch(errorType, maxMapSize, size); | ||
sketch = threshold != null ? new FrequentItemsSketch(errorType, maxMapSize, threshold.longValue(), size, config.getBulletRecordProvider()) : | ||
new FrequentItemsSketch(errorType, maxMapSize, size, config.getBulletRecordProvider()); |
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.
You can store a reference to the record provider above before the ternary since that seems to the be convention here
return new QuantileSketch(64, 6, Distribution.Type.QUANTILE, 10, bulletRecordProvider); | ||
} | ||
|
||
private BulletRecordProvider bulletRecordProvider; |
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.
Move this to before the methods
|
||
@BeforeMethod | ||
private void setup() { | ||
bulletRecordProvider = new BulletConfig().getBulletRecordProvider(); |
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 need a before method. Just use a static variable. Ditto for other test files
src/test/resources/test_config.yaml
Outdated
bullet.pubsub.class.name: "com.yahoo.bullet.pubsub.MockPubSub" | ||
bullet.pubsub.class.name: "com.yahoo.bullet.pubsub.MockPubSub" | ||
bullet.pubsub.rest.connect.timeout.ms: 88 | ||
bullet.record.provider.class.name: "com.yahoo.bullet.record.AvroBulletRecordProvider" |
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.
The default should be enough no?
No description provided.