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

Config slurper master #191

Closed

Conversation

kevinhinterlong
Copy link
Member

The config slurper allows fili to be set up in front of any instance of druid and probe druid to build metrics, dimensions, and tables.

*/
public class GenericBinder {
private static GenericBinder genericBinder;
private DruidWebService druidWebService;
Copy link
Member Author

Choose a reason for hiding this comment

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

This class has no longer has unused private fields

public static final int DEFAULT_KILOBYTES_PER_SKETCH = 16;
public static final int DEFAULT_SKETCH_SIZE_IN_BYTES = DEFAULT_KILOBYTES_PER_SKETCH * BYTES_PER_KILOBYTE;
private static final Logger LOG = LoggerFactory.getLogger(GenericMetricLoader.class);
final int sketchSize;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is copied directly from WikiMetricLoader so same issue would apply there


private final SystemConfig systemConfig = SystemConfigProvider.getInstance();

private final String defaultDimensionBackendKey = systemConfig.getPackageVariableName("dimension_backend");
Copy link
Member Author

Choose a reason for hiding this comment

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

Also copied directly from WikiDimensions


public static FiliMetricName getFiliMetricName(String name) {
if (defaultTimeGrain == null) {
throw new RuntimeException("Default time grain must be specified if no time grains are given");
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is generally an OK warning to ignore

@michael-mclawhorn michael-mclawhorn changed the base branch from master to JekyllSync March 14, 2017 15:23
@michael-mclawhorn michael-mclawhorn changed the base branch from JekyllSync to master March 14, 2017 15:24
* @param args command line arguments
* @throws Exception if the server fails to start or crashes
*/
public static void main(String[] args) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

* Created by kevin on 3/3/2017.
*/
public interface ConfigLoader {
public List<? extends DruidConfig> getTableNames();
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you prefer that these get removed?

* Created by kevin on 3/3/2017.
*/
public interface ConfigLoader {
public List<? extends DruidConfig> getTableNames();
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, in general comments on classes are a good idea, and necessary on interfaces.

However, I'm not sure I understand the connection between this interface and it's name. Further, there's already a class ConfigurationLoader, which I think this interface could easily be confused with.

Also, this interface appears to be a single method function. It's possible rather than have this be an explicit interface, you could instead make anything that is currently implementing it instead to implement:

Supplier<List<? extends DruidConfig>>

https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html

*
* @param table The TableConfig to be loaded with queries against druid.
*/
private void loadTable(TableConfig table) {
Copy link
Member Author

Choose a reason for hiding this comment

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

These should have javadoc comments showing example json being parsed

kevinhinterlong and others added 5 commits April 14, 2017 22:25
Add expected druid responses to druid navigator
…SlurperMaster

# Conflicts:
#	fili-core/src/main/java/com/yahoo/bard/webservice/util/IntervalUtils.java
#	fili-core/src/test/groovy/com/yahoo/bard/webservice/util/IntervalUtilsSpec.groovy
<version>0.8-SNAPSHOT</version>
</parent>

<artifactId>fili-generic-example</artifactId>
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I change the the name fili-generic-example?

</execution>
</executions>
<configuration>
<mainClass>com.yahoo.wiki.webservice.application.GenericMain</mainClass>
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactor .wiki

…SlurperMaster

# Conflicts:

#	fili-core/src/main/java/com/yahoo/bard/webservice/util/IntervalUtils.java

#	fili-core/src/test/groovy/com/yahoo/bard/webservice/util/IntervalUtilsSpec.groovy
String url = COORDINATOR_TABLES_PATH + table.getName() + "/?full";
queryDruid(rootNode -> {
JsonNode segments = rootNode.get("segments").get(0);
loadMetrics(table, segments);
Copy link
Contributor

Choose a reason for hiding this comment

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

Make a note in class comments that the schema of the first segment is for configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

NPE will be thrown if the segment list is empty. Perhaps we should catch and rethrow with a better error message.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

* @param metricDictionary Metric dictionary to use for generating the metric makers.
*/
protected void buildMetricMakers(MetricDictionary metricDictionary) {
// Create the various metric makers
Copy link
Contributor

Choose a reason for hiding this comment

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

Not that it's a big issue, but why is this implemented this way rather than having an initialize-once pattern?

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you want something like this?

if (doubleSumMaker == null) {
    doubleSumMaker = new DoubleSumMaker(metricDictionary);
}

});


}
Copy link
Contributor

Choose a reason for hiding this comment

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

extra vertical whitespace

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@cdeszaq cdeszaq mentioned this pull request Apr 20, 2017
@cdeszaq
Copy link
Collaborator

cdeszaq commented Apr 20, 2017

Merged in #251 Thx for the hard work! 🎉

@cdeszaq cdeszaq closed this Apr 20, 2017
@kevinhinterlong kevinhinterlong deleted the configSlurperMaster branch May 26, 2017 13:14
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.

4 participants