-
Notifications
You must be signed in to change notification settings - Fork 96
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
Allow Webservice to Configure Metric Long Name #492
Conversation
* @param calculation Mapper for the metric | ||
* @param logicalMetricInfo Logical Metric info provider | ||
*/ | ||
public LogicalMetric( |
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.
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
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.
Also, would we want to mark the other constructors with @Deprecated
telling people to use a LogicalMetricInfo
?
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.
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) { |
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.
It looks like this was only implemented for AggregationAverageMaker
, shouldn't it be done for all subclasses of MetricMaker
?
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.
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 |
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.
Would it make sense to proxy the other method into this one by building a default LogicalMetricInfo that is more or less backwards compatible?
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.
@michael-mclawhorn Yes! This is be a brilliant idea! 👍
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.
In addition to pushing people to use the new constructor via deprecations, perhaps add a test using the new makeInner.
Once you've addressed @kevinhinterlong comments I'll dismiss his review unless he jumps on here before then, |
I don't understand why we didn't go through and add makeInner(LogicalMetricInfo) to all the subclasses of MetricMaker. |
@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 |
05f277d
to
646c40b
Compare
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.
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); |
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 should give it a default implementation, if not other peoples metric maker will break because they don't have this makeInner
implemented.
4540c0c
to
1261d35
Compare
752b4cb
to
d713509
Compare
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.
Need to change this
@@ -23,6 +24,7 @@ | |||
*/ | |||
public class MetricInstance { | |||
|
|||
private final LogicalMetricInfo logicalMetricInfo; | |||
private final String metricName; |
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 don't think we need this anymore.
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.
Need CHANGELOG
this.logicalMetricInfo = new LogicalMetricInfo(metricName.asName()); | ||
this.maker = maker; | ||
this.dependencyMetricNames = new ArrayList<>(); | ||
for (FieldName fieldName : dependencyFields) { |
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.
Maybe make this streamy using Arrays.stream(...).map(...).collect(...)
I only skimmed through it so you may want to get a third review/dismiss mine, but from what I saw 👍 |
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'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. |
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.
which contains all these fields in addition to metric name.
No description provided.