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

Allow Webservice to Configure Metric Long Name #492

Merged
merged 5 commits into from
Sep 18, 2017

Conversation

QubitPi
Copy link
Contributor

@QubitPi QubitPi commented Aug 8, 2017

No description provided.

@yahoo yahoo deleted a comment Aug 8, 2017
@yahoo yahoo deleted a comment Aug 8, 2017
* @param calculation Mapper for the metric
* @param logicalMetricInfo Logical Metric info provider
*/
public LogicalMetric(
Copy link
Member

@kevinhinterlong kevinhinterlong Aug 8, 2017

Choose a reason for hiding this comment

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

It might be nice to implement this constructor and have everything else call this one.

You might also want to change this constructor LogicalMetricInfo(String name, String longName) to LogicalMetricInfo(String name, String description) since that's what LogicalMetric allows

Copy link
Member

Choose a reason for hiding this comment

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

Also, would we want to mark the other constructors with @Deprecated telling people to use a LogicalMetricInfo?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's go ahead and do this to push people toward the LogicalMetricInfo constructor

*
* @return the new logicalMetric
*/
protected LogicalMetric makeInner(LogicalMetricInfo logicalMetricInfo, List<String> dependentMetrics) {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this was only implemented for AggregationAverageMaker, shouldn't it be done for all subclasses of MetricMaker?

Copy link
Contributor Author

@QubitPi QubitPi Aug 30, 2017

Choose a reason for hiding this comment

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

Yes. AggregationAverageMaker is for experimenting. All subclasses will be modified

@@ -85,6 +86,21 @@ protected LogicalMetric makeInner(String metricName, List<String> dependentMetri
return new LogicalMetric(outerQuery, NO_OP_MAPPER, metricName);
}

@Override
protected LogicalMetric makeInner(LogicalMetricInfo logicalMetricInfo, List<String> dependentMetrics) {
// Get the Metric that is being averaged over
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to proxy the other method into this one by building a default LogicalMetricInfo that is more or less backwards compatible?

Copy link
Contributor Author

@QubitPi QubitPi Aug 30, 2017

Choose a reason for hiding this comment

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

@michael-mclawhorn Yes! This is be a brilliant idea! 👍

Copy link
Contributor

@michael-mclawhorn michael-mclawhorn left a comment

Choose a reason for hiding this comment

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

In addition to pushing people to use the new constructor via deprecations, perhaps add a test using the new makeInner.

@michael-mclawhorn
Copy link
Contributor

Once you've addressed @kevinhinterlong comments I'll dismiss his review unless he jumps on here before then,

@michael-mclawhorn
Copy link
Contributor

I don't understand why we didn't go through and add makeInner(LogicalMetricInfo) to all the subclasses of MetricMaker.

@QubitPi
Copy link
Contributor Author

QubitPi commented Aug 31, 2017

@michael-mclawhorn You are right. I'll add makeInner(LogicalMetricInfo) to all subclasses. The reason for not adding previously is to have an example implementation in AggregationAverageMaker.java for you to evaluate whether the implementation is good or not

@QubitPi QubitPi force-pushed the allow-webservice-to-configure-metric-long-name branch 2 times, most recently from 05f277d to 646c40b Compare August 31, 2017 00:17
@yahoo yahoo deleted a comment Aug 31, 2017
Copy link
Collaborator

@garyluoex garyluoex left a comment

Choose a reason for hiding this comment

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

Also, we need to change the api of MetricInstance and make make() to call make() with LogicalMetricInfo

*/
protected abstract LogicalMetric makeInner(String metricName, List<String> dependentMetrics);
protected abstract LogicalMetric makeInner(LogicalMetricInfo logicalMetricInfo, List<String> dependentMetrics);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should give it a default implementation, if not other peoples metric maker will break because they don't have this makeInner implemented.

@yahoo yahoo deleted a comment Sep 12, 2017
@QubitPi QubitPi force-pushed the allow-webservice-to-configure-metric-long-name branch from 4540c0c to 1261d35 Compare September 15, 2017 16:26
@yahoo yahoo deleted a comment Sep 15, 2017
@QubitPi QubitPi force-pushed the allow-webservice-to-configure-metric-long-name branch from 752b4cb to d713509 Compare September 15, 2017 16:34
@yahoo yahoo deleted a comment Sep 15, 2017
Copy link
Collaborator

@garyluoex garyluoex left a comment

Choose a reason for hiding this comment

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

Need to change this

@yahoo yahoo deleted a comment Sep 15, 2017
@@ -23,6 +24,7 @@
*/
public class MetricInstance {

private final LogicalMetricInfo logicalMetricInfo;
private final String metricName;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need this anymore.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Need CHANGELOG

@yahoo yahoo deleted a comment Sep 18, 2017
this.logicalMetricInfo = new LogicalMetricInfo(metricName.asName());
this.maker = maker;
this.dependencyMetricNames = new ArrayList<>();
for (FieldName fieldName : dependencyFields) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe make this streamy using Arrays.stream(...).map(...).collect(...)

@kevinhinterlong
Copy link
Member

I only skimmed through it so you may want to get a third review/dismiss mine, but from what I saw 👍

Copy link
Contributor

@michael-mclawhorn michael-mclawhorn left a comment

Choose a reason for hiding this comment

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

I've suggested a tweak to the CHANGELOG, but otherwise, ready to merge.

CHANGELOG.md Outdated
- [Allow Webservice to Configure Metric Long Name](https://github.com/yahoo/fili/pull/492)
* Logical metric needs more config-richness to not just configure metric name, but also metric long name,
description, etc. MetricInstance is now created by accepting a LogicalMetricInfo which contains all those
informations, instead of accepting a metric name.
Copy link
Contributor

Choose a reason for hiding this comment

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

which contains all these fields in addition to metric name.

@yahoo yahoo deleted a comment Sep 18, 2017
@QubitPi QubitPi merged commit 706f8b5 into master Sep 18, 2017
@QubitPi QubitPi deleted the allow-webservice-to-configure-metric-long-name branch September 18, 2017 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants